def run_and_exit(command_class):
    '''A shortcut for reading from sys.argv and exiting the interpreter'''
    cmd = command_class(sys.argv[1:])
    if cmd.error:
        print('error: {0}'.format(cmd.error))
        sys.exit(1)
    else:
        sys.exit(cmd.run())
A shortcut for reading from sys.argv and exiting the interpreter