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 get_plugin(self, target: str) -> importlib_metadata.Distribution: with enable_plugins(self.environment.config.plugins_dir): return importlib_metadata.distribution(target)