summaryrefslogtreecommitdiffstats
path: root/contrib/zsh_completion.in
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-21 07:53:13 -0500
committerDan McGee <dan@archlinux.org>2011-03-21 07:53:13 -0500
commit0ff52b68452046d61c24649ec94886bd74faab45 (patch)
treea9960a6143d17aeedeb530f2fe57c6796966e205 /contrib/zsh_completion.in
parentc67c864ffd50ec0e071b055897c4622eaa132fc2 (diff)
parentb0bb4f9024712adcee5e2baf6cebe73c966d7d7f (diff)
downloadpacman-0ff52b68452046d61c24649ec94886bd74faab45.tar.xz
Merge branch 'maint'
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c
Diffstat (limited to 'contrib/zsh_completion.in')
-rw-r--r--contrib/zsh_completion.in26
1 files changed, 12 insertions, 14 deletions
diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in
index 16919134..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
}
@@ -221,23 +222,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
}
@@ -245,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
}