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

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

 



Junio C Hamano venit, vidit, dixit 21.03.2011 22:48:
> 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.
> 
> Don't people usually use aliases so that they do not have to type long
> command names that would need completion?

I'd say this would be a perfect argument for "do not suggest aliases for
'git <cmd>'"; independent of that, we could still suggest aliases for
'git help <cmd>' since, presumably, you use commands more often than you
look up help...

But currently, we do it the other way round, and even worse:

git for<TAB>
for-each-ref-do   format-patch

git help for<TAB>
for-each-ref   format-patch

That is, git command completion lists aliases (for-each-ref-do) and
common commands, and git help completion lists no aliases and all commands.

The patch makes it so that the suggestions for git command are a subset
of those for git help command, which is a good thing. (Not completing
aliases for 'git <cmd>' would be good also, on top of that.)

And yes, I use git help <alias> a lot, because I don't like git config
--get alias.<alias>, and our config files tend to grow in ugliness over
time. (We need git config --broomstick or git config --vacuum.)

Michael
--
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]