[pacman-dev] [PATCH] zsh completion: get installed packages with pacman -Qq

Roma Kovalev roma.kvl at gmail.com
Sat Feb 7 23:30:14 UTC 2015


Currently _pacman_completions_installed_packages() globs the directory
@localstatedir@/lib/pacman/local/, this does not respect changes to DBPath in
/etc/pacman.conf, which cause completion to stop working. Instead of globbing
$(pacman -Qq) can be called to get a list of installed packages correctly.

Signed-off-by: Roma Kovalev <roma.kvl at gmail.com>
---
 contrib/zsh_completion.in | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in
index 1cae1de..0eae5e9 100644
--- a/contrib/zsh_completion.in
+++ b/contrib/zsh_completion.in
@@ -285,9 +285,8 @@ _pacman_completions_installed_groups() {
 
 # provides completions for installed packages
 _pacman_completions_installed_packages() {
-	local -a cmd packages packages_long
-	packages_long=(@localstatedir@/lib/pacman/local/*(/))
-	packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
+	local -a packages
+	packages=( $(pacman -Qq) )
 	compadd "$@" -a packages
 }
 
-- 
2.2.2


More information about the pacman-dev mailing list