Re: [PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-18 Thread Junio C Hamano
Jeff King writes: > The way it is written, I think the intent is that you would do: > > OPT_ARGUMENT("foo", &saw_foo, ...), > OPT_ARGUMENT("no-foo", &saw_no_foo, ...), > > I'm happy to punt on it until it ever comes up (which I suspect may be > never). Yeah, having to have one extra element

Re: [PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-18 Thread Jeff King
On Mon, Mar 18, 2019 at 11:47:20AM +0900, Junio C Hamano wrote: > Jeff King writes: > > >> +`OPT_ARGUMENT(long, &int_var, description)`:: > >>Introduce a long-option argument that will be kept in `argv[]`. > >> + If this option was seen, `int_var` will be set to one (except > >> + if a `NU

Re: [PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-17 Thread Junio C Hamano
Jeff King writes: >> +`OPT_ARGUMENT(long, &int_var, description)`:: >> Introduce a long-option argument that will be kept in `argv[]`. >> +If this option was seen, `int_var` will be set to one (except >> +if a `NULL` pointer was passed). > > So this effectively makes it into a "bool"

Re: [PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-15 Thread Johannes Schindelin
Hi Peff, On Thu, 14 Mar 2019, Jeff King wrote: > On Thu, Mar 14, 2019 at 04:25:04AM -0700, Johannes Schindelin via > GitGitGadget wrote: > > > diff --git a/Documentation/technical/api-parse-options.txt > > b/Documentation/technical/api-parse-options.txt > > index 2b036d7838..2e2e7c10c6 100644

Re: [PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-14 Thread Jeff King
On Thu, Mar 14, 2019 at 04:25:04AM -0700, Johannes Schindelin via GitGitGadget wrote: > diff --git a/Documentation/technical/api-parse-options.txt > b/Documentation/technical/api-parse-options.txt > index 2b036d7838..2e2e7c10c6 100644 > --- a/Documentation/technical/api-parse-options.txt > +++ b

[PATCH v2 2/3] parse-options: make OPT_ARGUMENT() more useful

2019-03-14 Thread Johannes Schindelin via GitGitGadget
From: Johannes Schindelin `OPT_ARGUMENT()` is intended to keep the specified long option in `argv` and not to do anything else. However, it would make a lot of sense for the caller to know whether this option was seen at all or not. For example, we want to teach `git difftool` to work outside of