From: Ævar Arnfjörð Bjarmason Date: Fri, 24 Sep 2021 12:52:55 GMT Subject: Re: [PATCH v4 01/15] scalar: create a rudimentary executable Message-ID: <87sfxu2kyc.fsf@evledraar.gmail.com> In-Reply-To: <852ec003109b8244e2f9360ec64749779989c4a2.1631630356.git.gitgitgadget@gmail.com> On Tue, Sep 14 2021, Johannes Schindelin via GitGitGadget wrote: > +int cmd_main(int argc, const char **argv) > +{ > + struct strbuf scalar_usage = STRBUF_INIT; > + int i; > + > + if (argc > 1) { > + argv++; > + argc--; > + > + for (i = 0; builtins[i].name; i++) > + if (!strcmp(builtins[i].name, argv[0])) > + return !!builtins[i].fn(argc, argv); > + } > + > + strbuf_addstr(&scalar_usage, > + N_("scalar []\n\nCommands:\n")); > + for (i = 0; builtins[i].name; i++) > + strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name); > + > + usage(scalar_usage.buf); > +} In 04/15 you continue and use the parse-options.c API, but here it's the usage.c API, which is generally being phased out. Any reason for the difference? It's preferrable not to add new usage() users if we can help it, I think we'll eventually want to remove it.