aztk/aztk_cli/plugins.py

31 строка
973 B
Python

import argparse
import typing
from aztk_cli import log
from aztk.models.plugins.internal import plugin_manager
def setup_parser(parser: argparse.ArgumentParser):
pass
def execute(args: typing.NamedTuple):
plugins = plugin_manager.plugins
log.info("------------------------------------------------------")
log.info(" Plugins (%i available)",len(plugins))
log.info("------------------------------------------------------")
for name, plugin in plugins.items():
log.info("- %s", name)
args = plugin_manager.get_args_for(plugin)
if args:
log.info(" Arguments:")
for arg in args.values():
log.info(" - %s", arg_str(arg))
else:
log.info(" Arguments: None")
log.info("")
def arg_str(arg):
required = "Required" if arg.required else "Optional(Default: {0})".format(arg.default)
return "{0}: {1}".format(arg.name, required)