mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-16 06:15:08 -05:00
Fix zsh completion
Fixes completion for "pacman -S <tab>" and "pacman -S repo/<tab>" Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
fd3acff5e6
commit
c3e72e11b6
@ -221,23 +221,20 @@ _pacman_completions_all_groups() {
|
|||||||
# these can be specified as either 'package' or 'repository/package'
|
# these can be specified as either 'package' or 'repository/package'
|
||||||
_pacman_completions_all_packages() {
|
_pacman_completions_all_packages() {
|
||||||
local -a cmd packages repositories packages_long
|
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})
|
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
||||||
typeset -U repositories
|
typeset -U repositories
|
||||||
_wanted repo_packages expl "repository/package" compadd -S "/" $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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user