public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "René Scharfe" <l.s.r@web•de>
Cc: Git List <git@vger•kernel.org>, Jeff King <peff@peff•net>,
	Jonathan Nieder <jrnieder@gmail•com>
Subject: Re: [PATCH 5/5] show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP
Date: Fri, 04 Dec 2015 10:40:07 -0800	[thread overview]
Message-ID: <xmqqtwnyrraw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <564B00BD.7010709@web.de> ("René Scharfe"'s message of "Tue, 17 Nov 2015 11:26:05 +0100")

René Scharfe <l.s.r@web•de> writes:

> The flag PARSE_OPT_NO_INTERNAL_HELP is set to allow overriding the
> option -h, except when it's the only one given.
> This is the default behavior now,...

OK, so in the old world order, "-h" used to trigger the internal
help even before consulting parse_short_opt() to see if there is a
handler supplied by the caller, and NO_INTERNAL_HELP was invented as
a kludge to to disable this behaviour.  The existing two users
(dealt with 4/5 and 5/5) both used this mechanism to let their own
handler kick in, but they had to make "-h" without anything else on
the command line behave just like the internal one, while handling
"-h" with something else on the command line do a custom thing.

In the new world order, internal "-h" handler is called only after
seeing that parse_short_opt() decides there is no handler for "-h"
as a fallback.

	Side note.  Not really.  Among the three uses of
	intenal_help in parse_options_step(), the first one ("lone
	-h asks for help") is used before we ask parse_short_opt().

I wonder if we can/want to further tweak this in a follow-up
series.  If that is done, I think NO_INTERNAL_HELP can go away, as
its only effect would be to make us say "unknown option" when "-h"
alone was given from the command line for an options[] array that
does not have a handler for "-h".

      reply	other threads:[~2015-12-04 18:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 10:19 [PATCH 0/5] parse-options: allow -h as a short option René Scharfe
2015-11-17 10:25 ` [PATCH 1/5] parse-options: deduplicate parse_options_usage() calls René Scharfe
2015-11-17 10:25 ` [PATCH 2/5] parse-options: inline parse_options_usage() at its only remaining caller René Scharfe
2015-11-17 10:25 ` [PATCH 3/5] parse-options: allow -h as a short option René Scharfe
2015-11-17 10:25 ` [PATCH 4/5] grep: stop using PARSE_OPT_NO_INTERNAL_HELP René Scharfe
2015-11-17 10:26 ` [PATCH 5/5] show-ref: " René Scharfe
2015-12-04 18:40   ` Junio C Hamano [this message]

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=xmqqtwnyrraw.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=l.s.r@web$(echo .)de \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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