Re: [RFC/PATCH v4 6/6] completion: add public _GIT_complete helper
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- May 7, 2012, 20:57 UTC
- Message-ID
- <CAMP44s2H1Fn-wY9bBnsjVUgE5ZRM4q-kOAtSHTm=tb1ku2xCvA@mail.gmail.com>
- In-Reply-To
- <7vbolz6cs9.fsf@alter.siamese.dyndns.org>
On Mon, May 7, 2012 at 8:56 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 34 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> So that users can easily define aliases, such as:
>>
>> _GIT_complete gf git_fetch
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>> contrib/completion/git-completion.bash | 10 +++++-----
>> t/t9902-completion.sh | 9 ++++++++-
>> 2 files changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index 049110e..2b7ef02 100755
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -2678,6 +2678,7 @@ _gitk ()
>>
>> __git_func_wrap ()
>> {
>> + local cmd="${1#git_}" cmd_pos=1
>> if [[ -n ${ZSH_VERSION-} ]]; then
>> emulate -L bash
>> setopt KSH_TYPESET
>> @@ -2695,8 +2696,7 @@ __git_func_wrap ()
>> _$1
>> }
>>
>> -# this is NOT a public function; use at your own risk
>> -__git_complete ()
>> +_GIT_complete ()
>
> If it is now a public function, please have some description as to how to
> use it for people who find this in the tarball extract.This is RFC, I'm not planning to push for this, I truly have given up on it.
Show 7 quoted lines
> I am guessing that > > _GIT_complete frotz git_fetch > > is a way to declare that 'git frotz' wants the same kind of completion as > 'git fetch' command, but I am not sure, as if it were the case it strikes > me somewhat odd that it is not "_GIT_complete frotz fetch".
Yeah, I think that would be nicer, but one would need to take into consideration the git/gitk cases.
Hopefully somebody else would pick this up and go through the eternal nitpicking.
Cheers.
-- Felipe Contreras