[pacman-dev] [PATCH] zsh: use pacman instead of parsing pacman.conf
Earnestly
zibeon at googlemail.com
Tue Jan 24 21:12:02 UTC 2017
This mimics the approach taken with the bash completion scripts and
simply calls pacman -Sl to generate our list of unique repositories.
This fixes cases where custom repos are defined in pacman.d/config
snippets.
---
scripts/completion/zsh_completion.in | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/scripts/completion/zsh_completion.in b/scripts/completion/zsh_completion.in
index f74fa297..d7435f6d 100644
--- a/scripts/completion/zsh_completion.in
+++ b/scripts/completion/zsh_completion.in
@@ -316,8 +316,7 @@ _pacman_completions_all_packages() {
typeset -U packages
${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
- repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
- typeset -U repositories
+ repositories=(${(u)${${(f)"$(pacman -Sl)"}%% *}})
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
fi
}
@@ -348,9 +347,7 @@ _pacman_all_packages() {
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
- repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
- # Uniq the array
- typeset -U repositories
+ repositories=(${(u)${${(f)"$(pacman -Sl)"}%% *}})
compadd "$@" -a repositories
}
--
2.11.0
More information about the pacman-dev
mailing list