Re: [PATCH 09/20] parse-options: add support for parsing subcommands
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Jul 25, 2022, 21:02 UTC
- Message-ID
- <20220725210236.GC2543@szeder.dev>
- In-Reply-To
- <220725.86wnc1nf6c.gmgdl@evledraar.gmail.com>
On Mon, Jul 25, 2022 at 09:41:52PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 15 quoted lines
> >> > + error("'cmd' is mandatory");
> >> > + usage_with_options(usage, test_flag_options);
> >>
> >> nit: I think you want usage_msg_optf() or usage_msg_opt().
> >
> > Maybe... but I don't know what they do ;) Though I remember removing
> > a couple of similar error() and usage_with_options() pairs from the
> > builtin commands.
>
> It's just helpers for "usage_with_options, except with a message, e.g.:
>
> $ ./git cat-file a b c
> fatal: only two arguments allowed in <type> <object> mode, not 3
>
> usage: git cat-file <type> <object>I've looked them up in the meantime. The problem is that they both output the given message with a "fatal:" prefix, but option parsing related errors are usually prefixed with "error:".