Message ID | patch-5.8-130e718722b-20220317T180439Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | cbe485298bf06a4e6377f5a692c82a9e3ad38069 |
Headers | show |
Series | reflog: migrate fully to parse_options() | expand |
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > Make use of the guaranteed pretty alignment of "-h" output added in my > 4631cfc20bd (parse-options: properly align continued usage output, > 2021-09-21) and wrap and format the "git reflog [expire|delete] -h" "(expire|delete) -h", I think. Does it matter who wrote an earlier commit, by the way? You do not name who did 33d7bdd6459 you refer to in the later part of the proposed log message, for example, and it feels simpler to consider all the past commits as just "ours". > usage output. Also add the missing "--single-worktree" option, as well > as adding other things that were in the SYNOPSIS output, but not in > the "-h" output. > > This was last touched in 33d7bdd6459 (builtin/reflog.c: use > parse-options api for expire, delete subcommands, 2022-01-06), but in > that commit the previous usage() output was faithfully > reproduced. Let's follow-up on that and make this even easier to read. > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > builtin/reflog.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/builtin/reflog.c b/builtin/reflog.c > index 25313d504a9..458764400b5 100644 > --- a/builtin/reflog.c > +++ b/builtin/reflog.c > @@ -6,14 +6,13 @@ > #include "reflog.h" > > #define BUILTIN_REFLOG_EXPIRE_USAGE \ > - N_("git reflog expire [--expire=<time>] " \ > - "[--expire-unreachable=<time>] " \ > - "[--rewrite] [--updateref] [--stale-fix] [--dry-run | -n] " \ > - "[--verbose] [--all] <refs>...") > + N_("git reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n" \ > + " [--rewrite] [--updateref] [--stale-fix]\n" \ > + " [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]") OK. This makes the line folding match what we write in the synopsis section of the documentation. > #define BUILTIN_REFLOG_DELETE_USAGE \ > - N_("git reflog delete [--rewrite] [--updateref] " \ > - "[--dry-run | -n] [--verbose] <refs>...") > + N_("git reflog delete [--rewrite] [--updateref]\n" \ > + " [--dry-run | -n] [--verbose] <ref>@{<specifier>}...") Likewise. Looking good. > #define BUILTIN_REFLOG_EXISTS_USAGE \ > N_("git reflog exists <ref>")
diff --git a/builtin/reflog.c b/builtin/reflog.c index 25313d504a9..458764400b5 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -6,14 +6,13 @@ #include "reflog.h" #define BUILTIN_REFLOG_EXPIRE_USAGE \ - N_("git reflog expire [--expire=<time>] " \ - "[--expire-unreachable=<time>] " \ - "[--rewrite] [--updateref] [--stale-fix] [--dry-run | -n] " \ - "[--verbose] [--all] <refs>...") + N_("git reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n" \ + " [--rewrite] [--updateref] [--stale-fix]\n" \ + " [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]") #define BUILTIN_REFLOG_DELETE_USAGE \ - N_("git reflog delete [--rewrite] [--updateref] " \ - "[--dry-run | -n] [--verbose] <refs>...") + N_("git reflog delete [--rewrite] [--updateref]\n" \ + " [--dry-run | -n] [--verbose] <ref>@{<specifier>}...") #define BUILTIN_REFLOG_EXISTS_USAGE \ N_("git reflog exists <ref>")
Make use of the guaranteed pretty alignment of "-h" output added in my 4631cfc20bd (parse-options: properly align continued usage output, 2021-09-21) and wrap and format the "git reflog [expire|delete] -h" usage output. Also add the missing "--single-worktree" option, as well as adding other things that were in the SYNOPSIS output, but not in the "-h" output. This was last touched in 33d7bdd6459 (builtin/reflog.c: use parse-options api for expire, delete subcommands, 2022-01-06), but in that commit the previous usage() output was faithfully reproduced. Let's follow-up on that and make this even easier to read. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/reflog.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)