zsh completion: add deptest and database

Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Daniel Wallace 2013-03-06 15:41:12 -05:00 committed by Allan McRae
parent c9b7f9b0d0
commit e43c271650

View file

@ -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,12 @@ _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]'
'*:installed package:_pacman_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
@ -164,6 +172,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
@ -288,6 +306,7 @@ _pacman_get_command() {
# main dispatcher
_pacman_zsh_comp() {
case $words[2] in
-D*) _pacman_action_database ;;
-Q*g*) # ipkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
@ -324,6 +343,12 @@ _pacman_zsh_comp() {
'*:package group:_pacman_completions_all_groups'
;;
-S*) _pacman_action_sync ;;
-T*)
_arguments -s : \
'-T' \
"$_pacman_opts_common[@]" \
":packages:_pacman_all_packages"
;;
-U*) _pacman_action_upgrade ;;
-V*) _pacman_action_version ;;
-h*) _pacman_action_help ;;