def main(argv=None): """Entrypoint for ``nexus3 repository`` subcommand.""" arguments = docopt(__doc__, argv=argv) command_method = util.find_cmd_method(arguments, globals()) # TODO: generic implementation in src/nexuscli/cli/__init__.py try: return command_method(util.get_client(), arguments) except exception.NexusClientConnectionError as e: print(f'Connection error: {e}') return errors.CliReturnCode.CONNECTION_ERROR.value
def _run_root_commands(arguments): # root commands are handled by methods named `root_commands.cmd_COMMAND`, # where COMMAND is the first argument given by the user from nexuscli.cli import root_commands command_method = getattr(root_commands, _find_root_command(arguments)) # don't show "missing config" error when the user is creating a config client = None if not arguments['login']: client = util.get_client() return command_method(client, arguments)
def test_get_client(mocker): """ Ensure the method returns the object created by NexusClient() and that the configuration loaded via config.load() """ nexus_config_mock = mocker.patch('nexuscli.cli.util.NexusConfig') nexus_client_mock = mocker.patch('nexuscli.cli.util.NexusClient') nexus_client = util.get_client() nexus_config_mock.return_value.load.assert_called_once() nexus_client_mock.assert_called_once() assert nexus_client == nexus_client_mock.return_value
def main(argv=None): """Entrypoint for ``nexus3 repository`` subcommand.""" arguments = docopt(__doc__, argv=argv) command_method = util.find_cmd_method(arguments, globals()) return command_method(util.get_client(), arguments)