Created
July 6, 2011 13:10
-
-
Save KyeRussell/1067180 to your computer and use it in GitHub Desktop.
Python Shell Emulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def help(): | |
print("HELP!!!") | |
def account_info(): | |
print("account infoz:!!!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
manipulate@hf ~$ help | |
HELP!!! | |
manipulate@hf ~$ account_info | |
account infoz:!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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