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

Andrew Gregory andrew.gregory.8 at gmail.com
Sun Feb 8 03:04:57 UTC 2015


On 02/08/15 at 02:30am, Roma Kovalev wrote:
> 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) )

This should use _pacman_get_command so that --root and --config
options will be taken into account.  _pacman_get_command should also
be updated to take --dbpath into account.

>  	compadd "$@" -a packages
>  }
>  
> -- 
> 2.2.2


More information about the pacman-dev mailing list