Re: [PATCH v4 5/9] parse-options: parse into strvec
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 5, 2020, 23:30 UTC
- Message-ID
- <20201005233016.GC1393696@google.com>
- In-Reply-To
- <20200909004939.1942347-6-emilyshaffer@google.com>
Emily Shaffer wrote:
> This is useful if collecting generic arguments to pass through to
> another command, for example, 'git hook run --arg "--quiet" --arg
> "--format=pretty" some-hook'. The resulting strvec would contain
> { "--quiet", "--format=pretty" }.An alternative is to use OPT_STRING_LIST and then convert in the caller. One advantage of that is that it would guarantee the behavior with --no-arg etc is going to match exactly.
I prefer this OPT_STRVEC approach nonetheless. Can the parse_opt_strvec and parse_opt_string_list functions get comments pointing to each other as an alternative way to encourage that kind of consistency?
[...]
Show 7 quoted lines
> --- a/Documentation/technical/api-parse-options.txt > +++ b/Documentation/technical/api-parse-options.txt > @@ -173,6 +173,11 @@ There are some macros to easily define options: > The string argument is stored as an element in `string_list`. > Use of `--no-option` will clear the list of preceding values. > > +`OPT_ARGV_ARRAY(short, long, &struct argv_array, arg_str, description)`::
nit: this should be OPT_STRVEC
Thanks, Jonathan