]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
cli: merge the better version of David-Sarah's split-usage-and-help patch with the...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 26 Jan 2010 04:45:59 +0000 (20:45 -0800)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 26 Jan 2010 04:45:59 +0000 (20:45 -0800)
src/allmydata/scripts/create_node.py
src/allmydata/scripts/runner.py

index 7e49ba430d13b1ded1d636f06bdf58008e7e67e6..4e23ac07ae54b9ebb564e78845f2b10d7ed813e1 100644 (file)
@@ -164,9 +164,9 @@ def create_introducer(basedir, config, out=sys.stdout, err=sys.stderr):
 
 
 subCommands = [
-    ["create-client", None, CreateClientOptions, "Create a client node."],
-    ["create-introducer", None, CreateIntroducerOptions, "Create a introducer node."],
-
+    ["create-node", None, CreateNodeOptions, "Create a node that acts as a client, server or both."],
+    ["create-client", None, CreateClientOptions, "Create a client node (with storage initially disabled)."],
+    ["create-introducer", None, CreateIntroducerOptions, "Create an introducer node."],
 ]
 
 dispatch = {
index 235cc2a072b9bb3704963dc5fe359d88cd97efa8..1ac8984ed8ed4811c3e34a0f67dd0d68ca9de98c 100644 (file)
@@ -10,24 +10,40 @@ pkg_resources.require('allmydata-tahoe')
 from allmydata.scripts.common import BaseOptions
 import debug, create_node, startstop_node, cli, keygen, stats_gatherer
 
-_general_commands = ( create_node.subCommands
-                    + keygen.subCommands
-                    + stats_gatherer.subCommands
-                    + debug.subCommands
-                    + cli.subCommands
-                    )
+def group(s):
+    return [["\n" + s, None, None, None]]
+
+_commandUsage = ( group("Administration")
+                +   create_node.subCommands
+                +   keygen.subCommands
+                +   stats_gatherer.subCommands
+                + group("Controlling a node")
+                +   startstop_node.subCommands
+                + group("Debugging")
+                +   debug.subCommands
+                + group("Using the filesystem")
+                +   cli.subCommands
+                )
+
+_subCommands = filter(lambda (a, b, c, d): not a.startswith("\n"), _commandUsage)
+_synopsis = "Usage:  tahoe <command> [command options]"
 
 class Options(BaseOptions, usage.Options):
-    synopsis = "Usage:  tahoe <command> [command options]"
+    synopsis = _synopsis
+    subCommands = _subCommands
 
-    subCommands = []
-    subCommands += _general_commands
-    subCommands += startstop_node.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):
         if not hasattr(self, 'subOptions'):
             raise usage.UsageError("must specify a command")
 
+class _Usage(BaseOptions, usage.Options):
+    synopsis = _synopsis
+    subCommands = _commandUsage
+
 def runner(argv,
            run_by_human=True,
            stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,