Skip to content

Instantly share code, notes, and snippets.

@siwells
Created August 16, 2011 09:03
Show Gist options
  • Save siwells/1148699 to your computer and use it in GitHub Desktop.
Save siwells/1148699 to your computer and use it in GitHub Desktop.
A simple example of using cmd to build a simple REPL within a python CLI tool.
import cmd
class CmdProcessor(cmd.Cmd):
"""A Simple Command Processor."""
def do_greeting(self, line):
print "Hello World!"
def do_EOF(self, line):
return True
def do_quit(self, line):
return True
if __name__ == '__main__':
CmdProcessor().cmdloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment