Re: [PATCH/RFC 5/5] help: add "-a --verbose" to list all commands with synopsis
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 9, 2018, 09:55 UTC
- Message-ID
- <CAPig+cSwDpWOz2_PAZOCmdhoYXYhYR0fHsw8POgNDfd9nD2Q1A@mail.gmail.com>
- In-Reply-To
- <xmqqh8ok679l.fsf@gitster-ct.c.googlers.com>
On Mon, Apr 9, 2018 at 5:47 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
>> On Mon, Mar 26, 2018 at 12:55 PM, Nguyễn Thái Ngọc Duy
>> <pclouds@gmail.com> wrote:
>>> + switch (category) {
>>> + case CAT_ancillaryinterrogators: return _("Ancillary interrogators");
>>> + case CAT_ancillarymanipulators: return _("Ancillary manipulators");
>>> + case CAT_foreignscminterface: return _("Foreign SCM interface");
>>> + case CAT_mainporcelain: return _("Main porcelain");
>>> + case CAT_plumbinginterrogators: return _("Plumbing interrogators");
>>> + case CAT_plumbingmanipulators: return _("Plumbing interrogators");
>>
>> s/interrogators"/manipulators"/
>>
>>> + case CAT_purehelpers: return _("Pure helpers");
>>> + case CAT_synchelpers: return _("Sync helpers");
>>> + case CAT_synchingrepositories: return _("Synching repositories");
>
> Somehow this screams "an array of strings" at me. Aren't this
> CAT_things small and dense enum?Duy's modified generate-cmdlist.sh does actually output an array of strings for these, but the (generated) array is commented out in this RFC. I suppose the reason it's not presently used is because the array looks like this:
static const char *cmd_categories[] = {
"ancillaryinterrogators",
"ancillarymanipulators",
"foreignscminterface",
"mainporcelain",
"plumbinginterrogators",
"plumbingmanipulators",
"purehelpers",
"synchelpers",
"synchingrepositories",
NULL
};which doesn't give quite the human-friendly output he'd like. The series is RFC, after all.
A possible approach to fix it would be to add a new "### categories" section to command-list.txt which associates those category tags ("ancillaryinterrogators") with human-readable counterparts ("Ancillary interrogators").