diff options
author | Mike Frysinger <vapier@google.com> | 2021-07-26 23:46:32 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-07-28 05:38:34 +0000 |
commit | 56345c345bdfdd71399d17ccd0ffe8f39bf720eb (patch) | |
tree | efea7101c53e3f8eaea34639a54d8caedd8aa45a /release | |
parent | a024bd33b808489acc909036b63697a819cc6ce7 (diff) | |
download | git-repo-56345c345bdfdd71399d17ccd0ffe8f39bf720eb.tar.gz |
repo: refactor help output handling
Currently we have the behavior:
* `repo`: Equivalent to `repo help` -- only shows common subcommands
(with short description), and then exits 0.
* `repo --help`: Shows repo's core options, lists all commands (no
specific info), and then exits 0.
The first case is not behaving well:
* If you run `repo` without a specific subcommand, that's an error,
so we should be exiting 1 instead.
* Showing only subcommands and no actual option summary makes it seem
like repo itself doesn't take any options. This confuses users.
Let's rework things a bit. Now we have the behavior:
* `repo`: Shows repo's core options, lists all commands (no specific
info), and then exits 1.
* `repo --help`: Shows repo's core options, shows common subcommands
(with short description), and then exits 0.
* `repo --help-all`: Shows repo's core options, shows all subcommands
(with short description), and then exits 0.
Basically we swap the behavior of `repo` and `repo --help`, and fix
the exit status when the subcommand is missing.
The addition of --help-all is mostly for the man pages. We were
relying on `repo help --all` to generate the repo(1) man page, but
that too omitted the core repo options. Now the man page includes
all the core repo options and provides a summary of all commands.
Change-Id: I1f99b99d5b8af2591f96a078d0647a3d76d6b0fc
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312908
Reviewed-by: Xin Li <delphij@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'release')
-rwxr-xr-x | release/update-manpages | 2 |
1 files changed, 1 insertions, 1 deletions
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' |