diff options
-rw-r--r-- | subcmds/help.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/subcmds/help.py b/subcmds/help.py index 90c12443..16f1f7f9 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
@@ -88,7 +88,7 @@ Displays detailed usage information about a command. | |||
88 | "See 'repo help <command>' for more information on a specific command.\n" | 88 | "See 'repo help <command>' for more information on a specific command.\n" |
89 | "See 'repo help --all' for a complete list of recognized commands.") | 89 | "See 'repo help --all' for a complete list of recognized commands.") |
90 | 90 | ||
91 | def _PrintCommandHelp(self, cmd): | 91 | def _PrintCommandHelp(self, cmd, header_prefix=''): |
92 | class _Out(Coloring): | 92 | class _Out(Coloring): |
93 | def __init__(self, gc): | 93 | def __init__(self, gc): |
94 | Coloring.__init__(self, gc, 'help') | 94 | Coloring.__init__(self, gc, 'help') |
@@ -106,7 +106,7 @@ Displays detailed usage information about a command. | |||
106 | 106 | ||
107 | self.nl() | 107 | self.nl() |
108 | 108 | ||
109 | self.heading('%s', heading) | 109 | self.heading('%s%s', header_prefix, heading) |
110 | self.nl() | 110 | self.nl() |
111 | self.nl() | 111 | self.nl() |
112 | 112 | ||
@@ -124,7 +124,7 @@ Displays detailed usage information about a command. | |||
124 | 124 | ||
125 | m = asciidoc_hdr.match(para) | 125 | m = asciidoc_hdr.match(para) |
126 | if m: | 126 | if m: |
127 | self.heading(m.group(1)) | 127 | self.heading('%s%s', header_prefix, m.group(1)) |
128 | self.nl() | 128 | self.nl() |
129 | self.nl() | 129 | self.nl() |
130 | continue | 130 | continue |
@@ -138,14 +138,25 @@ Displays detailed usage information about a command. | |||
138 | cmd.OptionParser.print_help() | 138 | cmd.OptionParser.print_help() |
139 | out._PrintSection('Description', 'helpDescription') | 139 | out._PrintSection('Description', 'helpDescription') |
140 | 140 | ||
141 | def _PrintAllCommandHelp(self): | ||
142 | for name in sorted(self.commands): | ||
143 | cmd = self.commands[name] | ||
144 | cmd.manifest = self.manifest | ||
145 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) | ||
146 | |||
141 | def _Options(self, p): | 147 | def _Options(self, p): |
142 | p.add_option('-a', '--all', | 148 | p.add_option('-a', '--all', |
143 | dest='show_all', action='store_true', | 149 | dest='show_all', action='store_true', |
144 | help='show the complete list of commands') | 150 | help='show the complete list of commands') |
151 | p.add_option('--help-all', | ||
152 | dest='show_all_help', action='store_true', | ||
153 | help='show the --help of all commands') | ||
145 | 154 | ||
146 | def Execute(self, opt, args): | 155 | def Execute(self, opt, args): |
147 | if len(args) == 0: | 156 | if len(args) == 0: |
148 | if opt.show_all: | 157 | if opt.show_all_help: |
158 | self._PrintAllCommandHelp() | ||
159 | elif opt.show_all: | ||
149 | self._PrintAllCommands() | 160 | self._PrintAllCommands() |
150 | else: | 161 | else: |
151 | self._PrintCommonCommands() | 162 | self._PrintCommonCommands() |