def main(): opts, args = main_parser.parse_args() if opts.help and not args: args = ['help'] if not args: main_parser.error('You must provide a command. ' '(Use `gh help` to see a list of commands)') repository = () if opts.repository and '/' in opts.repository: repository = opts.repository.split('/', 1) if opts.loc_aware and not repository: repository = get_repository_tuple() command = args[0].lower() load_command(command) status = 1 if command in commands: commands[command].repository = repository status = commands[command].run(opts, args[1:]) if status == commands[command].COMMAND_UNKNOWN: print('Unknown subcommand or option.') commands[command].help() sys.exit(status)
def main(): opts, args = main_parser.parse_args() if opts.help and not args: args = ['help'] if not args: main_parser.error('You must give a command. ' '(Use `gh help` to see a list of commands)') repository = () if opts.repository and '/' in opts.repository: repository = opts.repository.split('/', 1) if opts.loc_aware and not repository: repository = get_repository_tuple() command = args[0].lower() load_command(command) status = 1 if command in commands: commands[command].repository = repository status = commands[command].run(opts, args[1:]) if status == commands[command].COMMAND_UNKNOWN: print('Unknown subcommand or option.') commands[command].help() else: main_parser.error('No such command "{0}"'.format(command)) sys.exit(status)
def test_get_repository_tuple(self): ret = get_repository_tuple() assert ('sigmavirus24', 'Todo.txt-python') == ret