Re: [PATCH] git-completion: Add git help completion for aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 21, 2011 at 02:48:10PM -0700, Junio C Hamano wrote:
> Jakob Pfender <jpfender@xxxxxxxxxxxxx> writes:
> 
> > Enable bash completion for "git help <alias>", analogous to "git
> > <alias>", which was already implemented.
> >
> > Signed-off-by: Jakob Pfender <jpfender@xxxxxxxxxxxxx>
> > ---
> >  contrib/completion/git-completion.bash |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/contrib/completion/git-completion.bash
> > b/contrib/completion/git-completion.bash
> > index 893b771..f9a74d3 100755
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -1506,7 +1506,7 @@ _git_help ()
> >  		;;
> >  	esac
> >  	__git_compute_all_commands
> > -	__gitcomp "$__git_all_commands
> > +	__gitcomp "$__git_all_commands $(__git_aliases)
> >  		attributes cli core-tutorial cvs-migration
> >  		diffcore gitk glossary hooks ignore modules
> >  		repository-layout tutorial tutorial-2
> 
> This patch may not be _wrong_ per-se, but it it useful in practice?
> 
> I dunno.

I think most people use 'git help <cmd>' to bring up the man page of
given git command.  Since my aliases don't have a man page (and I
doubt that any alias will have one), I would never run 'git help
<alias>' myself, because it would only lead to a 'man page not
available' error.  Well, at least so I thought, because I never knew
that 'git help <alias>' actually prints the definition of the alias.
It's definitely shorter and easier than 'git config --get
alias.<alias>', but on the other hand it clutters 'git help <TAB>
output, especially if you have a lot of aliases.  If I had aliases
like 'ci' or 'co' instead of 'commit' and 'checkout', then I would
definitely not want to see them after 'git help <TAB>'.

So I don't know either.

Sidenote: the completion for 'git help' already lists custom git
commands (i.e. a script named 'git-<cmd>' somewhere in $PATH'), and
those are likely not documented either.

> Don't people usually use aliases so that they do not have to type long
> command names that would need completion?

I mostly use aliases for a command and a couple of options (e.g. a
custom log format), and give them meaningful names.


Best,
Gábor

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]