def get_subcommand_parser(self, version): parser = self.get_base_parser() self.subcommands = {} subparsers = parser.add_subparsers(metavar='<subcommand>') submodule = utils.import_versioned_module(version, 'shell') self._find_actions(subparsers, submodule) self._find_actions(subparsers, collector_shell) self._find_actions(subparsers, report_shell) self._find_actions(subparsers, storage_shell) extensions = extension.ExtensionManager(SUBMODULES_NAMESPACE, ) for ext in extensions: shell = ext.plugin.get_shell() self._find_actions(subparsers, shell) self._find_actions(subparsers, self) self._add_bash_completion_subparser(subparsers) return parser
def get_subcommand_parser(self, version): parser = self.get_base_parser() self.subcommands = {} subparsers = parser.add_subparsers(metavar='<subcommand>') submodule = utils.import_versioned_module(version, 'shell') self._find_actions(subparsers, submodule) self._find_actions(subparsers, collector_shell) self._find_actions(subparsers, report_shell) self._find_actions(subparsers, storage_shell) extensions = extension.ExtensionManager( SUBMODULES_NAMESPACE, ) for ext in extensions: shell = ext.plugin.get_shell() self._find_actions(subparsers, shell) self._find_actions(subparsers, self) self._add_bash_completion_subparser(subparsers) return parser
def get_subcommand_parser(self, version): parser = self.get_base_parser() self.subcommands = {} subparsers = parser.add_subparsers(metavar="<subcommand>") submodule = utils.import_versioned_module(version, "shell") self._find_actions(subparsers, submodule) # self._find_actions(subparsers, report_shell) self._find_actions(subparsers, billing_shell) self._find_actions(subparsers, storage_shell) extensions = extension.ExtensionManager(SUBMODULES_NAMESPACE) for ext in extensions: if ext.name == "hashmap": continue shell = ext.plugin.get_shell() self._find_actions(subparsers, shell) self._find_actions(subparsers, self) self._add_bash_completion_subparser(subparsers) return parser
def Client(version, *args, **kwargs): module = utils.import_versioned_module(version, 'client') client_class = getattr(module, 'Client') kwargs['token'] = kwargs.get('token') or kwargs.get('auth_token') return client_class(*args, **kwargs)