Created
April 21, 2016 00:26
-
-
Save bprashanth/9a3c8dfbba443698ddd960b8087107bf to your computer and use it in GitHub Desktop.
This file contains 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
from cmd import Cmd | |
class MyPrompt(Cmd): | |
def do_hello(self, args): | |
"""Says hello.""" | |
print "Hello, world" | |
def do_quit(self, args): | |
"""Quits the program.""" | |
print "Quitting." | |
raise SystemExit | |
if __name__ == '__main__': | |
prompt = MyPrompt() | |
prompt.prompt = '> ' | |
prompt.cmdloop('Starting prompt...') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment