[pacman-dev] [PATCH] zsh completion: make $tmp local
The tmp variable is conflicting with the $tmp variable in ${^fpath}/_main_complete(N) and which is used to complete all the functions, and causing an error: command not found: for whatever was in $tmp (which in this case is the last value in $words[@]) making it local fixes this. Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com> --- contrib/zsh_completion.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 8ad4a63..5096b8f 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -118,7 +118,6 @@ _pacman_action_help() { _pacman_action_none() { _arguments -s : \ "$_pacman_opts_commands[@]" - return 0 } # handles --query subcommand @@ -320,6 +319,7 @@ _pacman_get_command() { # main dispatcher _pacman_zsh_comp() { local -a args cmds; + local tmp args=( ${${${(M)words:#-*}#-}:#-*} ) for tmp in $words; do cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}") @@ -434,7 +434,6 @@ _pacman_zsh_comp() { esac ;; esac - return 0 } _key_shortopts=( -- 1.8.2
use setopt extendedglob to remove sigfiles from package completion Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com> --- contrib/zsh_completion.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 8ad4a63..3266792 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -3,6 +3,7 @@ # copy this file to /usr/share/zsh/site-functions/_pacman typeset -A opt_args +setopt extendedglob # options for passing to _arguments: main pacman commands _pacman_opts_commands=( @@ -39,7 +40,7 @@ _pacman_opts_pkgfile=( '--dbonly[Only remove database entry, do not remove files]' '--force[Overwrite conflicting files]' '--needed[Do not reinstall up to date packages]' - '*:package file:_files -g "*.pkg.tar*(.)"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.)"' ) # options for passing to _arguments: subactions for --query command @@ -131,7 +132,7 @@ _pacman_action_query() { _arguments -s : \ "$_pacman_opts_common[@]" \ "$_pacman_opts_query_modifiers[@]" \ - '*:package file:_files -g "*.pkg.tar*"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.)"' ;; query_group) _arguments -s : \ @@ -354,7 +355,7 @@ _pacman_zsh_comp() { _arguments -s : \ "$_pacman_opts_common[@]" \ "$_pacman_opts_query_modifiers[@]" \ - '*:package file:_files -g "*.pkg.tar*"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.)"' ;; T*) _pacman_action_deptest -- 1.8.2
use setopt extendedglob to remove sigfiles from package completion Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com> --- include symlinks as well contrib/zsh_completion.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 8ad4a63..b788f58 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -3,6 +3,7 @@ # copy this file to /usr/share/zsh/site-functions/_pacman typeset -A opt_args +setopt extendedglob # options for passing to _arguments: main pacman commands _pacman_opts_commands=( @@ -39,7 +40,7 @@ _pacman_opts_pkgfile=( '--dbonly[Only remove database entry, do not remove files]' '--force[Overwrite conflicting files]' '--needed[Do not reinstall up to date packages]' - '*:package file:_files -g "*.pkg.tar*(.)"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"' ) # options for passing to _arguments: subactions for --query command @@ -131,7 +132,7 @@ _pacman_action_query() { _arguments -s : \ "$_pacman_opts_common[@]" \ "$_pacman_opts_query_modifiers[@]" \ - '*:package file:_files -g "*.pkg.tar*"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"' ;; query_group) _arguments -s : \ @@ -354,7 +355,7 @@ _pacman_zsh_comp() { _arguments -s : \ "$_pacman_opts_common[@]" \ "$_pacman_opts_query_modifiers[@]" \ - '*:package file:_files -g "*.pkg.tar*"' + '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"' ;; T*) _pacman_action_deptest -- 1.8.2
participants (1)
-
Daniel Wallace