diff options
Diffstat (limited to 'subcmds/help.py')
-rw-r--r-- | subcmds/help.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/subcmds/help.py b/subcmds/help.py index 6a767e6f..1a60ef45 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
@@ -20,10 +20,11 @@ from subcmds import all_commands | |||
20 | from color import Coloring | 20 | from color import Coloring |
21 | from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand | 21 | from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand |
22 | import gitc_utils | 22 | import gitc_utils |
23 | from wrapper import Wrapper | ||
23 | 24 | ||
24 | 25 | ||
25 | class Help(PagedCommand, MirrorSafeCommand): | 26 | class Help(PagedCommand, MirrorSafeCommand): |
26 | common = False | 27 | COMMON = False |
27 | helpSummary = "Display detailed help on a command" | 28 | helpSummary = "Display detailed help on a command" |
28 | helpUsage = """ | 29 | helpUsage = """ |
29 | %prog [--all|command] | 30 | %prog [--all|command] |
@@ -49,14 +50,21 @@ Displays detailed usage information about a command. | |||
49 | 50 | ||
50 | def _PrintAllCommands(self): | 51 | def _PrintAllCommands(self): |
51 | print('usage: repo COMMAND [ARGS]') | 52 | print('usage: repo COMMAND [ARGS]') |
53 | self.PrintAllCommandsBody() | ||
54 | |||
55 | def PrintAllCommandsBody(self): | ||
52 | print('The complete list of recognized repo commands are:') | 56 | print('The complete list of recognized repo commands are:') |
53 | commandNames = list(sorted(all_commands)) | 57 | commandNames = list(sorted(all_commands)) |
54 | self._PrintCommands(commandNames) | 58 | self._PrintCommands(commandNames) |
55 | print("See 'repo help <command>' for more information on a " | 59 | print("See 'repo help <command>' for more information on a " |
56 | 'specific command.') | 60 | 'specific command.') |
61 | print('Bug reports:', Wrapper().BUG_URL) | ||
57 | 62 | ||
58 | def _PrintCommonCommands(self): | 63 | def _PrintCommonCommands(self): |
59 | print('usage: repo COMMAND [ARGS]') | 64 | print('usage: repo COMMAND [ARGS]') |
65 | self.PrintCommonCommandsBody() | ||
66 | |||
67 | def PrintCommonCommandsBody(self): | ||
60 | print('The most commonly used repo commands are:') | 68 | print('The most commonly used repo commands are:') |
61 | 69 | ||
62 | def gitc_supported(cmd): | 70 | def gitc_supported(cmd): |
@@ -72,12 +80,13 @@ Displays detailed usage information about a command. | |||
72 | 80 | ||
73 | commandNames = list(sorted([name | 81 | commandNames = list(sorted([name |
74 | for name, command in all_commands.items() | 82 | for name, command in all_commands.items() |
75 | if command.common and gitc_supported(command)])) | 83 | if command.COMMON and gitc_supported(command)])) |
76 | self._PrintCommands(commandNames) | 84 | self._PrintCommands(commandNames) |
77 | 85 | ||
78 | print( | 86 | print( |
79 | "See 'repo help <command>' for more information on a specific command.\n" | 87 | "See 'repo help <command>' for more information on a specific command.\n" |
80 | "See 'repo help --all' for a complete list of recognized commands.") | 88 | "See 'repo help --all' for a complete list of recognized commands.") |
89 | print('Bug reports:', Wrapper().BUG_URL) | ||
81 | 90 | ||
82 | def _PrintCommandHelp(self, cmd, header_prefix=''): | 91 | def _PrintCommandHelp(self, cmd, header_prefix=''): |
83 | class _Out(Coloring): | 92 | class _Out(Coloring): |
@@ -136,8 +145,7 @@ Displays detailed usage information about a command. | |||
136 | 145 | ||
137 | def _PrintAllCommandHelp(self): | 146 | def _PrintAllCommandHelp(self): |
138 | for name in sorted(all_commands): | 147 | for name in sorted(all_commands): |
139 | cmd = all_commands[name]() | 148 | cmd = all_commands[name](manifest=self.manifest) |
140 | cmd.manifest = self.manifest | ||
141 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) | 149 | self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) |
142 | 150 | ||
143 | def _Options(self, p): | 151 | def _Options(self, p): |
@@ -161,12 +169,11 @@ Displays detailed usage information about a command. | |||
161 | name = args[0] | 169 | name = args[0] |
162 | 170 | ||
163 | try: | 171 | try: |
164 | cmd = all_commands[name]() | 172 | cmd = all_commands[name](manifest=self.manifest) |
165 | except KeyError: | 173 | except KeyError: |
166 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) | 174 | print("repo: '%s' is not a repo command." % name, file=sys.stderr) |
167 | sys.exit(1) | 175 | sys.exit(1) |
168 | 176 | ||
169 | cmd.manifest = self.manifest | ||
170 | self._PrintCommandHelp(cmd) | 177 | self._PrintCommandHelp(cmd) |
171 | 178 | ||
172 | else: | 179 | else: |