From: SZEDER Gábor Date: Mon, 25 Jul 2022 21:02:36 GMT Subject: Re: [PATCH 09/20] parse-options: add support for parsing subcommands 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: > >> > + 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 mode, not 3 > > usage: git cat-file 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:".