From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
Pranit Bauva <pranit.bauva@gmail.com>,
Git List <git@vger.kernel.org>
Subject: Re: parse-options does not recognize "unspecified" behavior
Date: Wed, 16 Mar 2016 19:16:26 -0400 [thread overview]
Message-ID: <20160316231626.GA11808@sigill.intra.peff.net> (raw)
In-Reply-To: <CAGZ79kbbAv=PukD+sftmoO8u3GX=S1YCYGV8zcNMxrZ+E41-UA@mail.gmail.com>
On Wed, Mar 16, 2016 at 02:53:17PM -0700, Stefan Beller wrote:
> On Wed, Mar 16, 2016 at 2:44 PM, Jeff King <peff@peff.net> wrote:
> > On Wed, Mar 16, 2016 at 05:37:03PM -0400, Eric Sunshine wrote:
> >
> >> A much easier solution would be to update OPT_VERBOSE() to understand
> >> that negative values are "unspecified", and then --verbose would
> >> (pseudocode):
> >>
> >> if (value < 0)
> >> value = 0
> >> value++;
> >>
> >> and --no-verbose would:
> >>
> >> value = 0
> >>
> >> That should be compatible with existing clients of OPT__VERBOSE()
> >> which initialize the value to 0, and should satisfy Pranit's case; he
> >> can initialize it to -1, and if it is still -1 when option parsing is
> >> done, then he knows that neither --verbose nor --no-verbose was seen.
> >
> > Yes, that makes much more sense to me. Thanks for the back-story.
>
> Is there any command which needs more than one --no-verbose?
> (as an abuse to stacking --quiet multiple times)?
I'm not sure I understand. "--no-verbose" is just about resetting the
value. So you might get it multiple times in:
git commit -v --no-verbose -v --no-verbose
but the caller would not care. Which makes me think I'm misunderstanding
your question.
You also mention "--quiet", but that is not handled by OPT__VERBOSE, but
rather by OPT__QUIET. And there I do not think the "-1 is undefined"
trick works as well there, because presumably "-1" is the same as one
"--quiet".
-Peff
next prev parent reply other threads:[~2016-03-16 23:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 19:51 parse-options does not recognize "unspecified" behavior Pranit Bauva
2016-03-16 20:49 ` Jeff King
2016-03-16 21:06 ` Pranit Bauva
2016-03-16 21:23 ` Jeff King
2016-03-16 21:37 ` Eric Sunshine
2016-03-16 21:41 ` Pranit Bauva
2016-03-16 21:44 ` Jeff King
2016-03-16 21:53 ` Stefan Beller
2016-03-16 23:16 ` Jeff King [this message]
2016-03-16 23:33 ` Stefan Beller
2016-03-17 1:43 ` Jeff King
2016-03-17 5:32 ` Eric Sunshine
2016-03-17 5:40 ` Jeff King
2016-03-19 11:25 ` SZEDER Gábor
2016-03-19 16:55 ` Pranit Bauva
2016-03-25 14:58 ` SZEDER Gábor
2016-03-25 15:03 ` Pranit Bauva
2016-03-16 21:37 ` Pranit Bauva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160316231626.GA11808@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=pranit.bauva@gmail.com \
--cc=sbeller@google.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).