1 | --- old-tahoe/src/allmydata/scripts/runner.py 2010-01-11 05:17:12.270000000 +0000 |
---|
2 | +++ new-tahoe/src/allmydata/scripts/runner.py 2010-01-11 05:17:12.321000000 +0000 |
---|
3 | @@ -10,24 +10,40 @@ |
---|
4 | from allmydata.scripts.common import BaseOptions |
---|
5 | import debug, create_node, startstop_node, cli, keygen, stats_gatherer |
---|
6 | |
---|
7 | -_general_commands = ( create_node.subCommands |
---|
8 | - + keygen.subCommands |
---|
9 | - + stats_gatherer.subCommands |
---|
10 | - + debug.subCommands |
---|
11 | - + cli.subCommands |
---|
12 | - ) |
---|
13 | +def group(s): |
---|
14 | + return [["\n" + s, None, None, None]] |
---|
15 | + |
---|
16 | +_commandUsage = ( group("Administration") |
---|
17 | + + create_node.subCommands |
---|
18 | + + keygen.subCommands |
---|
19 | + + stats_gatherer.subCommands |
---|
20 | + + group("Controlling a node") |
---|
21 | + + startstop_node.subCommands |
---|
22 | + + group("Debugging") |
---|
23 | + + debug.subCommands |
---|
24 | + + group("Using the filesystem") |
---|
25 | + + cli.subCommands |
---|
26 | + ) |
---|
27 | + |
---|
28 | +_subCommands = filter(lambda (a, b, c, d): not a.startswith("\n"), _commandUsage) |
---|
29 | +_synopsis = "Usage: tahoe <command> [command options]" |
---|
30 | |
---|
31 | class Options(BaseOptions, usage.Options): |
---|
32 | - synopsis = "Usage: tahoe <command> [command options]" |
---|
33 | + synopsis = _synopsis |
---|
34 | + subCommands = _subCommands |
---|
35 | |
---|
36 | - subCommands = [] |
---|
37 | - subCommands += _general_commands |
---|
38 | - subCommands += startstop_node.subCommands |
---|
39 | + def getUsage(self, **kwargs): |
---|
40 | + t = _Usage().getUsage(**kwargs) |
---|
41 | + return t + "\nPlease run 'tahoe <command> --help' for more details on each command.\n" |
---|
42 | |
---|
43 | def postOptions(self): |
---|
44 | if not hasattr(self, 'subOptions'): |
---|
45 | raise usage.UsageError("must specify a command") |
---|
46 | |
---|
47 | +class _Usage(BaseOptions, usage.Options): |
---|
48 | + synopsis = _synopsis |
---|
49 | + subCommands = _commandUsage |
---|
50 | + |
---|
51 | def runner(argv, |
---|
52 | run_by_human=True, |
---|
53 | stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, |
---|