Re: [RFC/PATCH v4 6/6] completion: add public _GIT_complete helper
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 7, 2012, 18:56 UTC
- Message-ID
- <7vbolz6cs9.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1336353800-17323-7-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 29 quoted lines
> 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.
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".