From: Jeff King <peff@peff.net>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] grep: correct help string for --exclude-standard
Date: Wed, 4 Mar 2015 06:26:03 -0500 [thread overview]
Message-ID: <20150304112603.GA26545@peff.net> (raw)
In-Reply-To: <CACsJy8AW4=tsFLDcJb=is5UUdVyyFPD+AHi1v-xX=qCXLL_N2g@mail.gmail.com>
On Wed, Mar 04, 2015 at 06:13:32PM +0700, Duy Nguyen wrote:
> On Wed, Mar 4, 2015 at 5:16 PM, Jeff King <peff@peff.net> wrote:
> > Hmm. If the default is "--exclude-standard", then what expect people to
> > use is "--no-exclude-standard". Would it make more sense to list that in
> > the "-h" output?
>
> I thought about it and actually edited git-grep man page to clarify
> the default, only to find out this. When --untracked is used,
> --exclude-standard is the default. When --no-index is used,
> --no-exclude-standard is the default. Can't have it both ways. This is
> already mentioned with the subtle phrase "only useful with...".
Yuck. :)
I agree your patch is the right thing to do, then.
> > It might be nice if parseopt had a PARSE_OPT_NEGHELP option or something
> > to show the "--no-" form.
>
> Regardless, yes it would be nice to have something like this. I think
> there are places that can make use of this.
Grepping around, it looks like the best form would be an OPT_NEGBOOL
that acts like a boolean but negates the truth value, and advertises the
negative form. We have a lot of:
OPT_BOOL('n', "no-checkout", &option_no_checkout,
N_("don't create a checkout"))
where countermanding an earlier "--no-checkout" has to be spelled as
"--no-no-checkout", rather than "--checkout". If we could write:
OPT_NEGBOOL('n', "checkout", ...)
that would be nicer. But the short option is a bit weird. We'd want:
-n: option_no_checkout=true
--checkout: option_no_checkout=false
--no-checkout: option_no_checkout=true
That is, we flip the sense of the long option, but the short option
still yields "true". I think that would be useful, but it sure is weird
to explain.
-Peff
next prev parent reply other threads:[~2015-03-04 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 14:01 [PATCH] grep: correct help string for --exclude-standard Nguyễn Thái Ngọc Duy
2015-03-04 10:16 ` Jeff King
2015-03-04 11:13 ` Duy Nguyen
2015-03-04 11:26 ` Jeff King [this message]
2015-03-04 11:46 ` Duy Nguyen
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=20150304112603.GA26545@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.