Skip to content

Instantly share code, notes, and snippets.

@KyeRussell
Created July 6, 2011 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyeRussell/1067180 to your computer and use it in GitHub Desktop.
Save KyeRussell/1067180 to your computer and use it in GitHub Desktop.
Python Shell Emulator
def help():
print("HELP!!!")
def account_info():
print("account infoz:!!!")
manipulate@hf ~$ help
HELP!!!
manipulate@hf ~$ account_info
account infoz:!!!
import commands
commands = {'^help$': commands.help,
'^account_info(.*)': commands.account_info}
while True:
print acctusr + "@hf ~$ ",
command = raw_input()
for correct_command in commands.keys():
search = re.search(correct_command, command)
if search:
commands.get(correct_command)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment