Re: [PATCH v3 1/3] pretty.c: rework describe options parsing for better extensibility
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 29, 2021, 21:34 UTC
- Message-ID
- <xmqq35ojjz12.fsf@gitster.g>
- In-Reply-To
- <aef5409c-384e-1010-9f33-e3bfe1aa0685@archlinux.org>
Eli Schwartz <eschwartz@archlinux.org> writes:
Show 23 quoted lines
> On 10/29/21 4:11 PM, Junio C Hamano wrote:
>> Eli Schwartz <eschwartz@archlinux.org> writes:
>>
>>> + struct {
>>> + char *name;
>>> + enum { OPT_STRING } type;
>>> + } option[] = {
>>> + { "exclude", OPT_STRING },
>>> + { "match", OPT_STRING },
>>> + };
>>
>> I floated OPT_<TYPE> in my earlier illustration as "something like
>> this", not "literally use these tokens". We have CPP macros of the
>> same name in parse-options.h API---we may not see troubles from the
>> name clashes today, but let's not leave it to chances.
>>
>> Perhaps call it like DESCRBE_ARG_STRING or something that ensures
>> uniqueness like that?
>
>
> Ah. That alternative seems a bit long though. :( Without breaking enum
> type into one per line, it will quickly overflow line lengths... though
> maybe it should be one per line anyway?Yes, these things should be one item per line; a patch that adds or removes one would become easier to read.
> > Will try to put some thought into naming.