Re: [PATCH 09/20] parse-options: add support for parsing subcommands
From: SZEDER Gábor <hidden>
Date: 2022-07-25 21:02:45
From: SZEDER Gábor <hidden>
Date: 2022-07-25 21:02:45
On Mon, Jul 25, 2022 at 09:41:52PM +0200, Ævar Arnfjörð Bjarmason wrote:
quoted
quoted
quoted
+ 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:".