2018-02-27 03:36:31 +03:00
|
|
|
import argparse
|
|
|
|
import typing
|
2018-08-25 03:21:22 +03:00
|
|
|
|
2018-02-27 03:36:31 +03:00
|
|
|
from aztk.models.plugins.internal import plugin_manager
|
2018-08-25 03:21:22 +03:00
|
|
|
from aztk_cli import log
|
2018-02-27 03:36:31 +03:00
|
|
|
|
|
|
|
|
2018-08-25 03:21:22 +03:00
|
|
|
def setup_parser(_: argparse.ArgumentParser):
|
2018-02-27 03:36:31 +03:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def execute(args: typing.NamedTuple):
|
|
|
|
plugins = plugin_manager.plugins
|
|
|
|
log.info("------------------------------------------------------")
|
2018-08-07 01:29:06 +03:00
|
|
|
log.info(" Plugins (%i available)", len(plugins))
|
2018-02-27 03:36:31 +03:00
|
|
|
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)
|