Re: [PATCH] completion: zsh: trivial improvement

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

 



On Mon, Jun 07, 2021 at 09:38:07PM -0500, Felipe Contreras wrote:
> $words has basically all the words we need, except the first one: git.
> 
> Lets simply add that instead of passing the original, which contains
> options we don't want to pass downstream (like --git-dir).

In our Bash completion script $words contains all words of the current
command on the command line, including 'git -C tmp -c foo.bar=baz'.

Why should zsh completion behave differently?

> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  contrib/completion/git-completion.zsh | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index cac6f61881..50f89145f3 100644
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -219,9 +219,6 @@ __git_zsh_main ()
>  {
>  	local curcontext="$curcontext" state state_descr line
>  	typeset -A opt_args
> -	local -a orig_words
> -
> -	orig_words=( ${words[@]} )
>  
>  	_arguments -C \
>  		'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
> @@ -261,7 +258,7 @@ __git_zsh_main ()
>  
>  		(( $+opt_args[--help] )) && command='help'
>  
> -		words=( ${orig_words[@]} )
> +		words=( git ${words[@]} )
>  
>  		__git_zsh_bash_func $command
>  		;;
> -- 
> 2.32.0.2.g41be0a4e50
> 



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

  Powered by Linux