mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-20 00:03:58 +00:00
cli: merge the better version of David-Sarah's split-usage-and-help patch with the earlier version that I mistakenly committed
This commit is contained in:
@ -164,9 +164,9 @@ def create_introducer(basedir, config, out=sys.stdout, err=sys.stderr):
|
|||||||
|
|
||||||
|
|
||||||
subCommands = [
|
subCommands = [
|
||||||
["create-client", None, CreateClientOptions, "Create a client node."],
|
["create-node", None, CreateNodeOptions, "Create a node that acts as a client, server or both."],
|
||||||
["create-introducer", None, CreateIntroducerOptions, "Create a introducer node."],
|
["create-client", None, CreateClientOptions, "Create a client node (with storage initially disabled)."],
|
||||||
|
["create-introducer", None, CreateIntroducerOptions, "Create an introducer node."],
|
||||||
]
|
]
|
||||||
|
|
||||||
dispatch = {
|
dispatch = {
|
||||||
|
@ -10,24 +10,40 @@ pkg_resources.require('allmydata-tahoe')
|
|||||||
from allmydata.scripts.common import BaseOptions
|
from allmydata.scripts.common import BaseOptions
|
||||||
import debug, create_node, startstop_node, cli, keygen, stats_gatherer
|
import debug, create_node, startstop_node, cli, keygen, stats_gatherer
|
||||||
|
|
||||||
_general_commands = ( create_node.subCommands
|
def group(s):
|
||||||
|
return [["\n" + s, None, None, None]]
|
||||||
|
|
||||||
|
_commandUsage = ( group("Administration")
|
||||||
|
+ create_node.subCommands
|
||||||
+ keygen.subCommands
|
+ keygen.subCommands
|
||||||
+ stats_gatherer.subCommands
|
+ stats_gatherer.subCommands
|
||||||
|
+ group("Controlling a node")
|
||||||
|
+ startstop_node.subCommands
|
||||||
|
+ group("Debugging")
|
||||||
+ debug.subCommands
|
+ debug.subCommands
|
||||||
|
+ group("Using the filesystem")
|
||||||
+ cli.subCommands
|
+ cli.subCommands
|
||||||
)
|
)
|
||||||
|
|
||||||
class Options(BaseOptions, usage.Options):
|
_subCommands = filter(lambda (a, b, c, d): not a.startswith("\n"), _commandUsage)
|
||||||
synopsis = "Usage: tahoe <command> [command options]"
|
_synopsis = "Usage: tahoe <command> [command options]"
|
||||||
|
|
||||||
subCommands = []
|
class Options(BaseOptions, usage.Options):
|
||||||
subCommands += _general_commands
|
synopsis = _synopsis
|
||||||
subCommands += startstop_node.subCommands
|
subCommands = _subCommands
|
||||||
|
|
||||||
|
def getUsage(self, **kwargs):
|
||||||
|
t = _Usage().getUsage(**kwargs)
|
||||||
|
return t + "\nPlease run 'tahoe <command> --help' for more details on each command.\n"
|
||||||
|
|
||||||
def postOptions(self):
|
def postOptions(self):
|
||||||
if not hasattr(self, 'subOptions'):
|
if not hasattr(self, 'subOptions'):
|
||||||
raise usage.UsageError("must specify a command")
|
raise usage.UsageError("must specify a command")
|
||||||
|
|
||||||
|
class _Usage(BaseOptions, usage.Options):
|
||||||
|
synopsis = _synopsis
|
||||||
|
subCommands = _commandUsage
|
||||||
|
|
||||||
def runner(argv,
|
def runner(argv,
|
||||||
run_by_human=True,
|
run_by_human=True,
|
||||||
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,
|
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,
|
||||||
|
Reference in New Issue
Block a user