diff options
-rwxr-xr-x | main.py | 30 | ||||
-rw-r--r-- | man/repo-manifest.1 | 19 | ||||
-rw-r--r-- | man/repo.1 | 42 | ||||
-rwxr-xr-x | release/update-manpages | 2 | ||||
-rw-r--r-- | subcmds/help.py | 7 |
5 files changed, 81 insertions, 19 deletions
@@ -95,6 +95,8 @@ global_options = optparse.OptionParser( | |||
95 | add_help_option=False) | 95 | add_help_option=False) |
96 | global_options.add_option('-h', '--help', action='store_true', | 96 | global_options.add_option('-h', '--help', action='store_true', |
97 | help='show this help message and exit') | 97 | help='show this help message and exit') |
98 | global_options.add_option('--help-all', action='store_true', | ||
99 | help='show this help message with all subcommands and exit') | ||
98 | global_options.add_option('-p', '--paginate', | 100 | global_options.add_option('-p', '--paginate', |
99 | dest='pager', action='store_true', | 101 | dest='pager', action='store_true', |
100 | help='display command output in the pager') | 102 | help='display command output in the pager') |
@@ -128,6 +130,23 @@ class _Repo(object): | |||
128 | self.repodir = repodir | 130 | self.repodir = repodir |
129 | self.commands = all_commands | 131 | self.commands = all_commands |
130 | 132 | ||
133 | def _PrintHelp(self, short: bool = False, all_commands: bool = False): | ||
134 | """Show --help screen.""" | ||
135 | global_options.print_help() | ||
136 | print() | ||
137 | if short: | ||
138 | commands = ' '.join(sorted(self.commands)) | ||
139 | wrapped_commands = textwrap.wrap(commands, width=77) | ||
140 | print('Available commands:\n %s' % ('\n '.join(wrapped_commands),)) | ||
141 | print('\nRun `repo help <command>` for command-specific details.') | ||
142 | print('Bug reports:', Wrapper().BUG_URL) | ||
143 | else: | ||
144 | cmd = self.commands['help']() | ||
145 | if all_commands: | ||
146 | cmd.PrintAllCommandsBody() | ||
147 | else: | ||
148 | cmd.PrintCommonCommandsBody() | ||
149 | |||
131 | def _ParseArgs(self, argv): | 150 | def _ParseArgs(self, argv): |
132 | """Parse the main `repo` command line options.""" | 151 | """Parse the main `repo` command line options.""" |
133 | for i, arg in enumerate(argv): | 152 | for i, arg in enumerate(argv): |
@@ -177,19 +196,16 @@ class _Repo(object): | |||
177 | SetTrace() | 196 | SetTrace() |
178 | 197 | ||
179 | # Handle options that terminate quickly first. | 198 | # Handle options that terminate quickly first. |
180 | if gopts.help: | 199 | if gopts.help or gopts.help_all: |
181 | global_options.print_help() | 200 | self._PrintHelp(short=False, all_commands=gopts.help_all) |
182 | commands = ' '.join(sorted(self.commands)) | ||
183 | wrapped_commands = textwrap.wrap(commands, width=77) | ||
184 | print('\nAvailable commands:\n %s' % ('\n '.join(wrapped_commands),)) | ||
185 | print('\nRun `repo help <command>` for command-specific details.') | ||
186 | return 0 | 201 | return 0 |
187 | elif gopts.show_version: | 202 | elif gopts.show_version: |
188 | # Always allow global --version regardless of subcommand validity. | 203 | # Always allow global --version regardless of subcommand validity. |
189 | name = 'version' | 204 | name = 'version' |
190 | elif not name: | 205 | elif not name: |
191 | # No subcommand specified, so show the help/subcommand. | 206 | # No subcommand specified, so show the help/subcommand. |
192 | name = 'help' | 207 | self._PrintHelp(short=True) |
208 | return 1 | ||
193 | 209 | ||
194 | SetDefaultColoring(gopts.color) | 210 | SetDefaultColoring(gopts.color) |
195 | 211 | ||
diff --git a/man/repo-manifest.1 b/man/repo-manifest.1 index e42cc42e..be467607 100644 --- a/man/repo-manifest.1 +++ b/man/repo-manifest.1 | |||
@@ -36,6 +36,9 @@ output manifest in JSON format (experimental) | |||
36 | \fB\-\-pretty\fR | 36 | \fB\-\-pretty\fR |
37 | format output for humans to read | 37 | format output for humans to read |
38 | .TP | 38 | .TP |
39 | \fB\-\-no\-local\-manifests\fR | ||
40 | ignore local manifests | ||
41 | .TP | ||
39 | \fB\-o\fR \-|NAME.xml, \fB\-\-output\-file\fR=\fI\,\-\/\fR|NAME.xml | 42 | \fB\-o\fR \-|NAME.xml, \fB\-\-output\-file\fR=\fI\,\-\/\fR|NAME.xml |
40 | file to save the manifest to | 43 | file to save the manifest to |
41 | .SS Logging options: | 44 | .SS Logging options: |
@@ -95,7 +98,7 @@ include*)> | |||
95 | .IP | 98 | .IP |
96 | <!ELEMENT notice (#PCDATA)> | 99 | <!ELEMENT notice (#PCDATA)> |
97 | .IP | 100 | .IP |
98 | <!ELEMENT remote EMPTY> | 101 | <!ELEMENT remote (annotation*)> |
99 | <!ATTLIST remote name ID #REQUIRED> | 102 | <!ATTLIST remote name ID #REQUIRED> |
100 | <!ATTLIST remote alias CDATA #IMPLIED> | 103 | <!ATTLIST remote alias CDATA #IMPLIED> |
101 | <!ATTLIST remote fetch CDATA #REQUIRED> | 104 | <!ATTLIST remote fetch CDATA #REQUIRED> |
@@ -393,13 +396,13 @@ Same syntax as the corresponding element of `project`. | |||
393 | .PP | 396 | .PP |
394 | Element annotation | 397 | Element annotation |
395 | .PP | 398 | .PP |
396 | Zero or more annotation elements may be specified as children of a project | 399 | Zero or more annotation elements may be specified as children of a project or |
397 | element. Each element describes a name\-value pair that will be exported into | 400 | remote element. Each element describes a name\-value pair. For projects, this |
398 | each project's environment during a 'forall' command, prefixed with REPO__. In | 401 | name\-value pair will be exported into each project's environment during a |
399 | addition, there is an optional attribute "keep" which accepts the case | 402 | \&'forall' command, prefixed with `REPO__`. In addition, there is an optional |
400 | insensitive values "true" (default) or "false". This attribute determines | 403 | attribute "keep" which accepts the case insensitive values "true" (default) or |
401 | whether or not the annotation will be kept when exported with the manifest | 404 | "false". This attribute determines whether or not the annotation will be kept |
402 | subcommand. | 405 | when exported with the manifest subcommand. |
403 | .PP | 406 | .PP |
404 | Element copyfile | 407 | Element copyfile |
405 | .PP | 408 | .PP |
@@ -2,9 +2,44 @@ | |||
2 | .TH REPO "1" "July 2021" "repo" "Repo Manual" | 2 | .TH REPO "1" "July 2021" "repo" "Repo Manual" |
3 | .SH NAME | 3 | .SH NAME |
4 | repo \- repository management tool built on top of git | 4 | repo \- repository management tool built on top of git |
5 | .SH DESCRIPTION | 5 | .SH SYNOPSIS |
6 | usage: repo COMMAND [ARGS] | 6 | .B repo |
7 | The complete list of recognized repo commands are: | 7 | [\fI\,-p|--paginate|--no-pager\/\fR] \fI\,COMMAND \/\fR[\fI\,ARGS\/\fR] |
8 | .SH OPTIONS | ||
9 | .TP | ||
10 | \fB\-h\fR, \fB\-\-help\fR | ||
11 | show this help message and exit | ||
12 | .TP | ||
13 | \fB\-\-help\-all\fR | ||
14 | show this help message with all subcommands and exit | ||
15 | .TP | ||
16 | \fB\-p\fR, \fB\-\-paginate\fR | ||
17 | display command output in the pager | ||
18 | .TP | ||
19 | \fB\-\-no\-pager\fR | ||
20 | disable the pager | ||
21 | .TP | ||
22 | \fB\-\-color\fR=\fI\,COLOR\/\fR | ||
23 | control color usage: auto, always, never | ||
24 | .TP | ||
25 | \fB\-\-trace\fR | ||
26 | trace git command execution (REPO_TRACE=1) | ||
27 | .TP | ||
28 | \fB\-\-trace\-python\fR | ||
29 | trace python command execution | ||
30 | .TP | ||
31 | \fB\-\-time\fR | ||
32 | time repo command execution | ||
33 | .TP | ||
34 | \fB\-\-version\fR | ||
35 | display this version of repo | ||
36 | .TP | ||
37 | \fB\-\-event\-log\fR=\fI\,EVENT_LOG\/\fR | ||
38 | filename of event log to append timeline to | ||
39 | .TP | ||
40 | \fB\-\-git\-trace2\-event\-log\fR=\fI\,GIT_TRACE2_EVENT_LOG\/\fR | ||
41 | directory to write git trace2 event log to | ||
42 | .SS "The complete list of recognized repo commands are:" | ||
8 | .TP | 43 | .TP |
9 | abandon | 44 | abandon |
10 | Permanently abandon a development branch | 45 | Permanently abandon a development branch |
@@ -91,3 +126,4 @@ version | |||
91 | Display the version of repo | 126 | Display the version of repo |
92 | .PP | 127 | .PP |
93 | See 'repo help <command>' for more information on a specific command. | 128 | See 'repo help <command>' for more information on a specific command. |
129 | Bug reports: https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue | ||
diff --git a/release/update-manpages b/release/update-manpages index 3aeee206..f841f306 100755 --- a/release/update-manpages +++ b/release/update-manpages | |||
@@ -59,7 +59,7 @@ def main(argv): | |||
59 | cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git', | 59 | cmdlist.append(['help2man', '-N', '-n', 'repository management tool built on top of git', |
60 | '-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}', | 60 | '-S', 'repo', '-m', 'Repo Manual', f'--version-string={version}', |
61 | '-o', MANDIR.joinpath('repo.1'), TOPDIR.joinpath('repo'), | 61 | '-o', MANDIR.joinpath('repo.1'), TOPDIR.joinpath('repo'), |
62 | '-h', 'help --all']) | 62 | '-h', '--help-all']) |
63 | 63 | ||
64 | with tempfile.TemporaryDirectory() as tempdir: | 64 | with tempfile.TemporaryDirectory() as tempdir: |
65 | repo_dir = Path(tempdir) / '.repo' | 65 | repo_dir = Path(tempdir) / '.repo' |
diff --git a/subcmds/help.py b/subcmds/help.py index f302e75c..1a60ef45 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
@@ -50,14 +50,21 @@ Displays detailed usage information about a command. | |||
50 | 50 | ||
51 | def _PrintAllCommands(self): | 51 | def _PrintAllCommands(self): |
52 | print('usage: repo COMMAND [ARGS]') | 52 | print('usage: repo COMMAND [ARGS]') |
53 | self.PrintAllCommandsBody() | ||
54 | |||
55 | def PrintAllCommandsBody(self): | ||
53 | print('The complete list of recognized repo commands are:') | 56 | print('The complete list of recognized repo commands are:') |
54 | commandNames = list(sorted(all_commands)) | 57 | commandNames = list(sorted(all_commands)) |
55 | self._PrintCommands(commandNames) | 58 | self._PrintCommands(commandNames) |
56 | print("See 'repo help <command>' for more information on a " | 59 | print("See 'repo help <command>' for more information on a " |
57 | 'specific command.') | 60 | 'specific command.') |
61 | print('Bug reports:', Wrapper().BUG_URL) | ||
58 | 62 | ||
59 | def _PrintCommonCommands(self): | 63 | def _PrintCommonCommands(self): |
60 | print('usage: repo COMMAND [ARGS]') | 64 | print('usage: repo COMMAND [ARGS]') |
65 | self.PrintCommonCommandsBody() | ||
66 | |||
67 | def PrintCommonCommandsBody(self): | ||
61 | print('The most commonly used repo commands are:') | 68 | print('The most commonly used repo commands are:') |
62 | 69 | ||
63 | def gitc_supported(cmd): | 70 | def gitc_supported(cmd): |