Re: [PATCH] api-parse-options.txt: document OPT_CMDMODE()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 24, 2016 at 10:46 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Pranit Bauva <pranit.bauva@xxxxxxxxx> writes:
>
>>>> +`OPT_CMDMODE(short, long, &int_var, description, enum_val)`::
>>>> +     Introduce an option for subcommands. It is useful when you want to use
>>>> +     the command with a particular sub command only and ignore other sub
>>>> +     commands it has. It will set `int_var` to enum_val if the argument is
>>>> +     invoked.
>>>> +
>>>
>>> Sorry, but I do not get what "when you want to... ignore other sub
>>> command it has" wants to say.
>>
>> What I meant by this statement is that (your example), let's say we
>> have "add", "remove" and "edit" sub commands. Now the user has to pick
>> between the three. He cannot choose more than 1 from these.
>
> Then I find the word "ignore others" misleading.  Quite the
> contrary, the user has to be aware of the others and not to give
> them.
>
>         Define an "operating mode" option, only one of which in the
>         same group of "operating mode" options that share the same
>         `int_var` can be given by the user.  `enum_val` is set to
>         `int_var` when the option is used, but an error is reported
>         if other "operating mode" option has already set its value
>         to the same `int_var`.
>
> or something?

Seems a crystal clear explanation to me. Thanks. I was unaware that it
throws an error.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]