def help_hello(self):
    print('syntax: hello [message]', end=' ')
print('-- prints a hello message')

def do_quit(self, arg):
    sys.exit(1)

def help_quit(self):
    print('syntax: quit', end=' ')
print('-- terminates the application')
do_q = do_quit
cli = CLI()
cli.cmdloop()
How to setup iPython as a simplified command shell for the average user