All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"H.Merijn Brand" <h.m.brand@xs4all.nl>
Subject: Re: [PATCH] help: show manpage for aliased command on git <alias> --help
Date: Wed, 06 Mar 2013 14:10:01 +0100	[thread overview]
Message-ID: <51374029.6080906@drmicha.warpmail.net> (raw)
In-Reply-To: <20130305173831.GB9379@sigill.intra.peff.net>

Jeff King venit, vidit, dixit 05.03.2013 18:38:
> On Tue, Mar 05, 2013 at 02:44:41PM +0000, Ævar Arnfjörð Bjarmason wrote:
> 
>> Change the semantics of "git <alias> --help" to show the help for the
>> command <alias> is aliased to, instead of just saying:
>>
>>     `git <alias>' is aliased to `<whatever>'
>>
>> E.g. if you have "checkout" aliased to "co" you won't get:
>>
>>     $ git co --help
>>     `git co' is aliased to `checkout'
>>
>> But will instead get the manpage for git-checkout. The behavior this
>> is replacing was originally added by Jeff King in 2156435. I'm
>> changing it because of this off-the-cuff comment on IRC:
>>
>>     14:27:43 <@Tux> git can be very unhelpful, literally:
>>     14:27:46 <@Tux> $ git co --help
>>     14:27:46 <@Tux> `git co' is aliased to `checkout'
>>     14:28:08 <@Tux> I know!, gimme the help for checkout, please
>>
>> And because I also think it makes more sense than showing you what the
>> thing is aliased to.
> 
> In this simple case, I think it is helpful to show the "checkout"
> manpage, because there is no other information to give (and by showing
> the checkout manpage, you implicitly indicate that "co" maps to
> "checkout").

Well, even in the simple case one has to wonder: Why does the user
invoke help for "co"? There are two very likely cases:

A) User does not remember what "co" is aliased to.
B) User wants to see the man page.

If A is not the case then it's easy for the user to request help for
"checkout" (or "commit" or ...).

Removing the only easy way to look up the definition of an alias is a
major regression. And no, "git config --get alias.co" is not an easy way.

Removing that easy way would be OK only after introducing a "git alias"
command which works similar to shell's alias. You can even set it up as
an alias for git config, of course.

> But like others, I am concerned about the other cases, where there is no
> manpage, it is not a git command with a manpage, or it is a git command
> with options.  You are losing useful information that is currently given
> to the user in all but the single-word case.
> 
> In an ideal world, we could say "here is how the alias expands, and by
> the way, here is the manpage for the expanded command". And obviously
> just omit the latter part when there is no such page. But we are relying
> on external programs to do the presentation and paging. Doing the
> C equivalent of:
> 
>   echo "'git co' is aliased to 'checkout'" &&
>   man checkout
> 
> does not quite work, because "man" will start a pager. We can run our
> own pager (which should suppress man's invocation), but that is a
> regression for anyone who uses MANPAGER.
> 
> The user may also be using help.format to use something besides man. If
> help.format is set to "html", we will spawn a browser. In that case we
> can still output the alias information, but it may or may not be seen
> (though come to think of it, that is probably already a problem for "git
> help <alias>" on Windows systems, or anybody invoking git help from a
> GUI porcelain).
> 
> So I'd only be in favor of this patch if it managed to avoid information
> loss in the more complicated cases. And I'm not sure how best to do
> that. The "only trigger for a single-word alias" suggestion seems like
> the least ugly to me.
> 
> -Peff
> 

  reply	other threads:[~2013-03-06 13:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 14:44 [PATCH] help: show manpage for aliased command on git <alias> --help Ævar Arnfjörð Bjarmason
2013-03-05 15:42 ` Johannes Sixt
2013-03-05 15:54   ` H.Merijn Brand
2013-03-05 16:41     ` Matthieu Moy
2013-03-05 16:16 ` Junio C Hamano
2013-03-05 16:32   ` Ævar Arnfjörð Bjarmason
2013-03-05 16:52     ` Junio C Hamano
2013-03-05 17:38 ` Jeff King
2013-03-06 13:10   ` Michael J Gruber [this message]
2013-03-06 23:55     ` Junio C Hamano

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=51374029.6080906@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=h.m.brand@xs4all.nl \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /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.