diff options
author | Mohammad Alsaleh <ce.mohammad.alsaleh@gmail.com> | 2015-10-23 00:38:50 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-11-03 06:07:11 +0100 |
commit | 0fd6d354a6b8de976ec9b6a146c4cb8cdcdd5ebb (patch) | |
tree | 8fee0b8c4b840beee140f0992115747ffed7bd48 /contrib | |
parent | d5b0f0c26f5dc139c5c8e534cafc017956229f66 (diff) | |
download | pacman-0fd6d354a6b8de976ec9b6a146c4cb8cdcdd5ebb.tar.gz pacman-0fd6d354a6b8de976ec9b6a146c4cb8cdcdd5ebb.tar.xz |
zsh_completion: Handle --ignore/--ignoregroup correctly
Completion now works as expected with a comma-separated sequence.
Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/zsh_completion.in | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 69485f5e..0db26b2c 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -252,23 +252,36 @@ _pacman_completions_all_groups() { _pacman_get_command groups=( $(_call_program groups $cmd[@] -Sg) ) typeset -U groups - compadd "$@" -a groups + + if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then + _sequence compadd -S ',' "$@" -a groups + else + compadd "$@" -a groups + fi } # provides completions for packages available from repositories # these can be specified as either 'package' or 'repository/package' _pacman_completions_all_packages() { - local -a cmd packages repositories packages_long + local -a seq sep cmd packages repositories packages_long _pacman_get_command + if [[ ${words[CURRENT-1]} == '--ignore' ]]; then + seq='_sequence' + sep=(-S ',') + else + seq= + sep=() + fi + if compset -P1 '*/*'; then packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) typeset -U packages - _wanted repo_packages expl "repository/package" compadd ${(@)packages} + ${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages} else packages=( $(_call_program packages $cmd[@] -Sql) ) typeset -U packages - _wanted packages expl "packages" compadd - "${(@)packages}" + ${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}" repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options}) typeset -U repositories |