From: Ævar Arnfjörð Bjarmason Date: Wed, 29 Dec 2021 00:04:35 GMT Subject: Re: [PATCH 5/7] help: error if [-a|-g|-c] and [-i|-m|-w] are combined Message-ID: <211229.86v8z8gtt4.gmgdl@evledraar.gmail.com> In-Reply-To: On Tue, Dec 28 2021, Eric Sunshine wrote: > On Tue, Dec 28, 2021 at 10:36 AM Ævar Arnfjörð Bjarmason > wrote: >> Add more sanity checking to "git help" usage by erroring out if these >> man viewer options are combined with incompatible command-modes that >> will never use these documentation viewers. >> >> This continues the work started in d35d03cf93e (help: simplify by >> moving to OPT_CMDMODE(), 2021-09-22) of adding more sanity checking to >> "git help". Doing this allows us to clarify the "SYNOPSIS" in the >> documentation, and the "git help -h" output. >> >> Signed-off-by: Ævar Arnfjörð Bjarmason >> --- >> diff --git a/builtin/help.c b/builtin/help.c >> @@ -581,6 +581,13 @@ static void no_extra_argc(int argc) >> +static void no_format(void) >> +{ >> + if (help_format != HELP_FORMAT_NONE) >> + usage_msg_opt(_("[-a|--all] cannot be combined with [[-i|--info] [-m|--man] [-w|--web]]"), >> + builtin_help_usage, builtin_help_options); >> +} > > Nit: The square brackets in the message may be unnecessarily > confusing. (Indeed, what exactly do they mean in this context?) Also, > the short options may not add much value: the user who typed `-w` > knows presumably that it is shorthand for `--web`. So, one > simplification would be: > > '--all' cannot be combined with '--info', '--man', or '--web' Thanks, will change it.