def plugin_list(platform, phase, detail): def plugin_filter(platform, phase, plugin_info): result = True if platform: result = platform in plugin_info.platforms if phase: result = result and (phase in plugin_info.phases) return result pm = PluginManager() pm.filter = partial(plugin_filter, platform, phase) nop = pm.locate_plugins() plugins = pm.load_plugins() if platform: click.echo("Plugins for platform: {}".format(platform)) if phase: click.echo("Plugins for phase: {}".format(phase)) click.echo("Number of plugins: {}\n".format(nop)) print_plugin_info(plugins, detail)