From c3e72e11b643b2a24608e1936763fb148613e464 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 21 Mar 2011 14:11:18 +1000 Subject: Fix zsh completion Fixes completion for "pacman -S " and "pacman -S repo/" Signed-off-by: Allan McRae Signed-off-by: Lukas Fleischer Signed-off-by: Dan McGee --- contrib/zsh_completion.in | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'contrib/zsh_completion.in') diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 16919134..fded4144 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -221,23 +221,20 @@ _pacman_completions_all_groups() { # these can be specified as either 'package' or 'repository/package' _pacman_completions_all_packages() { local -a cmd packages repositories packages_long + _pacman_get_command + + if compset -P1 '*/*'; then + packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) + typeset -U packages + _wanted repo_packages expl "repository/package" compadd ${(@)packages} + else + packages=( $(_call_program packages $cmd[@] -Sql) ) + typeset -U packages + _wanted packages expl "packages" compadd - "${(@)packages}" - repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options}) - typeset -U repositories - packages_long=(@localstatedir@/lib/pacman/sync/${^repositories}/*(/)) - packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} ) - typeset -U packages - _wanted packages expl "packages" compadd - "${(@)packages}" - if [[ $PREFIX != */* ]] ; then repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options}) typeset -U repositories _wanted repo_packages expl "repository/package" compadd -S "/" $repositories - else - compset -P '*/' - packages_long=(@localstatedir@/lib/pacman/sync/$IPREFIX*(/)) - packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} ) - typeset -U packages - _wanted repo_packages expl "repository/package" compadd ${(@)packages} fi } -- cgit v1.2.3-70-g09d2 From 9cab9807e02674fd5a7efcea2a408c70c1f9d40c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 21 Mar 2011 15:16:51 +1000 Subject: Some more zsh completion tidy up Changes for consistency across functions Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- contrib/zsh_completion.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib/zsh_completion.in') diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index fded4144..2131412c 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -214,6 +214,7 @@ _pacman_completions_all_groups() { local -a cmd groups _pacman_get_command groups=( $(_call_program groups $cmd[@] -Sg) ) + typeset -U groups compadd "$@" -a groups } @@ -242,7 +243,7 @@ _pacman_completions_all_packages() { _pacman_completions_installed_groups() { local -a cmd groups _pacman_get_command - groups=(${(o)${(f)"$(pacman -Qg)"}% *}) + groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *}) typeset -U groups compadd "$@" -a groups } -- cgit v1.2.3-70-g09d2