From: robk-tahoe Date: Wed, 9 Jan 2008 02:51:18 +0000 (-0700) Subject: tweak running to make node start/stop code optional X-Git-Url: https://git.rkrishnan.org/pf/content//%22%22?a=commitdiff_plain;h=4e3f0892574aab4cc14916c01fb51b818430f3be;p=tahoe-lafs%2Ftahoe-lafs.git tweak running to make node start/stop code optional add a 'install_node_control' flag to runner.run(), default True this enables the start/stop node commands which are not too useful on windows --- diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index b39e5b48..fe51dc38 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -6,21 +6,32 @@ from twisted.python import usage from allmydata.scripts.common import BaseOptions import debug, create_node, startstop_node, cli +_general_commands = create_node.subCommands + debug.subCommands + cli.subCommands + class Options(BaseOptions, usage.Options): synopsis = "Usage: tahoe [command options]" subCommands = [] - subCommands += create_node.subCommands + subCommands += _general_commands subCommands += startstop_node.subCommands - subCommands += debug.subCommands - subCommands += cli.subCommands def postOptions(self): if not hasattr(self, 'subOptions'): raise usage.UsageError("must specify a command") -def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr): - config = Options() +class OptionsNoNodeControl(Options): + synopsis = "Usage: tahoe [command options]" + + subCommands = [] + subCommands += _general_commands + + +def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr, + install_node_control=True): + if install_node_control: + config = Options() + else: + config = OptionsNoNodeControl() try: config.parseOptions(argv) except usage.error, e: @@ -54,6 +65,6 @@ def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr): return rc -def run(): +def run(install_node_control=True): rc = runner(sys.argv[1:]) sys.exit(rc)