Re: [PATCH 5/7] help: error if [-a|-g|-c] and [-i|-m|-w] are combined
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 28, 2021, 16:18 UTC
- Message-ID
- <CAPig+cSVLPiGUAiK8tt1dp3BVLAwXCAeMvM9LenBUY4s_xBQ+A@mail.gmail.com>
- In-Reply-To
- <patch-5.7-12ff152bd57-20211228T153456Z-avarab@gmail.com>
On Tue, Dec 28, 2021 at 10:36 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 19 quoted lines
> 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 <avarab@gmail.com>
> ---
> 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'