fix-v0.2
Tom Wilson 5 years ago
parent 82cc667cbb
commit 9781d7f77b

@ -169,30 +169,29 @@ def compile_config(default_config_path):
return core_conf, plugin_classes, plugin_configs
@click.group(invoke_without_command = True)
@click.group(invoke_without_command=True)
#help="Path to default config TOML file"
@click.argument('default_config', default="shepherd-default.toml", type=click.Path())
@click.pass_context
def cli(ctx, default_config):
"""
Core service. Expects the default config to be set as an argument.
"""
#argparser = argparse.ArgumentParser(description="Keep track of a mob "
# argparser = argparse.ArgumentParser(description="Keep track of a mob "
# "of roaming Pis")
#argparser.add_argument("configfile", nargs='?', metavar="configfile",
# argparser.add_argument("configfile", nargs='?', metavar="configfile",
# help="Path to configfile", default="shepherd.toml")
#argparser.add_argument(
# argparser.add_argument(
# '-e', '--noedit', help="Disable the editable config temporarily", action="store_true", default=False)
#argparser.add_argument("-t", "--test", help="Test and interface function of the from 'plugin:function'",
# argparser.add_argument("-t", "--test", help="Test and interface function of the from 'plugin:function'",
# default=None)
#args = argparser.parse_args()
core_conf, plugin_classes, plugin_configs = compile_config(default_config)
if args.test is None:
control.init_control(core_conf, plugin_configs)
# if args.test is None:
# control.init_control(core_conf, plugin_configs)
scheduler.init_scheduler(core_conf)
plugin.init_plugins(plugin_classes, plugin_configs, core_conf)
@ -209,11 +208,11 @@ def cli(ctx, default_config):
except (KeyboardInterrupt, SystemExit):
pass
@click.argument('plugin_function')
@cli.command()
def test():
if args.test is not None:
(test_plugin, test_func) = args.test.split(':')
func = getattr(shepherd.plugin.plugin_functions[test_plugin], test_func)
print(func())
return
def test(plugin_function):
(test_plugin, test_func) = plugin_function.split(':')
func = getattr(plugin.plugin_functions[test_plugin], test_func)
print(func())
return

Loading…
Cancel
Save