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

Allan McRae allan at archlinux.org
Sun Feb 8 02:46:42 UTC 2015


On 08/02/15 09:30, 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>
> ---

Ack - I assume this was originally done for speed.  But changing this is
also robust for potential local database format changes.

A

>  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
>  }
>  
> 


More information about the pacman-dev mailing list