[pacman-dev] [PATCH 1/4] zsh completion: add deptest and database

Allan McRae allan at archlinux.org
Sat Mar 9 02:34:28 EST 2013


On 07/03/13 07:13, Daniel Wallace wrote:
> Signed-off-by: Daniel Wallace <danielwallace at gtmanfred.com>
> ---
>  contrib/zsh_completion.in | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in
> index 84ee93c..a40192c 100644
> --- a/contrib/zsh_completion.in
> +++ b/contrib/zsh_completion.in
> @@ -6,9 +6,11 @@ typeset -A opt_args
>  
>  # options for passing to _arguments: main pacman commands
>  _pacman_opts_commands=(
> +	'-D[Modify database]'
>  	'-Q[Query the package database]'
>  	'-R[Remove a package from the system]'
>  	'-S[Synchronize packages]'
> +	'-T[Check if dependencies are installed]'
>  	'-U[Upgrade a package]'
>  	'-V[Display version and exit]'
>  	'-h[Display usage]'
> @@ -71,6 +73,11 @@ _pacman_opts_remove=(
>  	'*:installed package:_pacman_completions_installed_packages'
>  )
>  
> +_pacman_opts_database=(
> +    '--asdeps[mark packages as non-explicitly installed]'
> +    '--asexplicit[mark packages as explicitly installed]'
> +)
> +
>  # options for passing to _arguments: options for --sync command
>  _pacman_opts_sync_actions=(
>  	'*-c[Remove old packages from cache]:*:clean:->sync_clean'
> @@ -164,6 +171,16 @@ _pacman_action_remove() {
>  		"$_pacman_opts_remove[@]"
>  }
>  
> +# handles --database subcommand
> +_pacman_action_database() {
> +	_arguments -s : \
> +		'-D' \
> +		"$_pacman_opts_common[@]" \
> +		"$_pacman_opts_database[@]"
> +}
> +
> +
> +
>  # handles --sync subcommand
>  _pacman_action_sync() {
>  	local context state line
> @@ -309,6 +326,13 @@ _pacman_zsh_comp() {
>  		-Q*)  _pacman_action_query    ;;
>  		-R*)  _pacman_action_remove   ;;
>  		-S*c*) # no completion

Looks like you inserted into the middle of this...

> +		-T*)
> +			 _arguments -s : \
> +				'-T' \
> +				"$_pacman_opts_common[@]" \
> +				":packages:_pacman_all_packages"
> +			 ;;
> +		-D*)  _pacman_action_database ;;

Keep this in alphabetical order like the rest of the file.

>  			return 0
>  			;;
>  		-S*l*) # repos
> 



More information about the pacman-dev mailing list