Re: git alias and --help

5 messages, 4 authors, 2016-06-15 · open the first message on its own page

Re: git alias and --help

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:20

Miles Bader [off-list ref] writes:
Of course, that would be the wrong thing for somebody that just wants
to be reminded what an alias expands too, but my intuition is that
this is a very tiny minority compared to people that want to examine
the options for the underlying command...
And it is doubly wrong if help backend is configured to be anything but
manpages, no?

As I said, you should be able to come up with a patch that detects and
special cases the no frills case (replacement to single token) to get what
you want.

Re: git alias and --help

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:52:20

Junio C Hamano venit, vidit, dixit 28.10.2011 06:05:
Miles Bader [off-list ref] writes:
quoted
Of course, that would be the wrong thing for somebody that just wants
to be reminded what an alias expands too, but my intuition is that
this is a very tiny minority compared to people that want to examine
the options for the underlying command...
And it is doubly wrong if help backend is configured to be anything but
manpages, no?

As I said, you should be able to come up with a patch that detects and
special cases the no frills case (replacement to single token) to get what
you want.
But "help" is still too much to type for the OP ;) How about this in
your config:

[alias]
	h = help
	hh = "!sh -c 'a=$(git config --get alias.$1); : ${a:=$1}; git help
${a%% *}' -"

Ugly as hell, I know, and works only for aliases whose first word is the
name of a git command, as well as for non-aliases. Catching "!command"
type aliases is left as an exercise to the reader.

Michael

Re: git alias and --help

From: Gelonida N <hidden>
Date: 2016-06-15 22:52:20

On 10/28/2011 06:05 AM, Junio C Hamano wrote:
Miles Bader [off-list ref] writes:
quoted
Of course, that would be the wrong thing for somebody that just wants
to be reminded what an alias expands too, but my intuition is that
this is a very tiny minority compared to people that want to examine
the options for the underlying command...
And it is doubly wrong if help backend is configured to be anything but
manpages, no?
Well. Then it is already doubly wrong today, isnt it?
The output of 'git help b'
is not a man page I assume.

In my opinion chaning it to a short message + the output of a man page
is not really worse than today's behaviour.
As I said, you should be able to come up with a patch that detects and
special cases the no frills case (replacement to single token) to get what
you want.
That's perhaps the most comfortable one, though occasionally I am even
interested in the help text of a git command if I had an alias like

l = log --name-status

to see what other switches I could add


(Thus an alternative suggestion to display both or to have a special
syntax allowing to force displaying of a man page)



Another small detail:

Let's assume I have following alias:

log = log --name-status


In this case I directly get the help text for git log
if I typed 'git log --help' (or 'git help log').
I don't even see, that my log is in reality aliased.

Re: git alias and --help

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:52:20

Gelonida N [off-list ref] writes:

[...]
Another small detail:

Let's assume I have following alias:

log = log --name-status


In this case I directly get the help text for git log
if I typed 'git log --help' (or 'git help log').
I don't even see, that my log is in reality aliased.
That is because it doesn't work: git does not allow for aliasing its
built-in commands.

-- 
Jakub Narębski

Re: git alias and --help

From: Gelonida N <hidden>
Date: 2016-06-15 22:52:20

On 10/28/2011 03:27 PM, Jakub Narebski wrote:
Gelonida N [off-list ref] writes:

[...]
quoted
Another small detail:

Let's assume I have following alias:

log = log --name-status


In this case I directly get the help text for git log
if I typed 'git log --help' (or 'git help log').
I don't even see, that my log is in reality aliased.
That is because it doesn't work: git does not allow for aliasing its
built-in commands.

Well this explains why.
Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help