def cli_sessions(env: Environment, args: argparse.Namespace) -> ExitStatus: action = args.cli_sessions_action if action is None: parser.error(missing_subcommand('cli', 'sessions')) if action == 'upgrade': return cli_upgrade_session(env, args) elif action == 'upgrade-all': return cli_upgrade_all_sessions(env, args) else: raise ValueError(f'Unexpected action: {action}')
def run( self, action: Optional[str], args: argparse.Namespace, ) -> ExitStatus: from httpie.plugins.manager import enable_plugins if action is None: parser.error(missing_subcommand('plugins')) with enable_plugins(self.dir): if action == 'install': status = self.install(args.targets) elif action == 'uninstall': status = self.uninstall(args.targets) elif action == 'list': status = self.list() return status or ExitStatus.SUCCESS
def dispatch_cli_task(env: Environment, action: Optional[str], args: argparse.Namespace) -> ExitStatus: if action is None: parser.error(missing_subcommand('cli')) return CLI_TASKS[action](env, args)