zsh completion: include flags that can be doubled

include the flags that could be doubled up like -Sii -Syy -Suu -Qii etc
also include the long opts of all the commands

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-08 15:59:29 -05:00 committed by Allan McRae
parent 0d4ecae625
commit 0e5c22e7a1

View file

@ -6,23 +6,23 @@ typeset -A opt_args
# options for passing to _arguments: main pacman commands # options for passing to _arguments: main pacman commands
_pacman_opts_commands=( _pacman_opts_commands=(
'-D[Modify database]' {-D,--database}'[Modify database]'
'-Q[Query the package database]' {-Q,--query}'[Query the package database]'
'-R[Remove a package from the system]' {-R,--remove}'[Remove a package from the system]'
'-S[Synchronize packages]' {-S,--sync}'[Synchronize packages]'
'-T[Check if dependencies are installed]' {-T,--deptest}'[Check if dependencies are installed]'
'-U[Upgrade a package]' {-U,--upgrade}'[Upgrade a package]'
'-V[Display version and exit]' {-V,--version}'[Display version and exit]'
'-h[Display usage]' {-h,--help}'[Display usage]'
) )
# options for passing to _arguments: options common to all commands # options for passing to _arguments: options common to all commands
_pacman_opts_common=( _pacman_opts_common=(
'-b[Alternate database location]:database_location:_files -/' {-b,--dbpath}'[Alternate database location]:database_location:_files -/'
'--color[colorize the output]:color options:(always never auto)' '--color[colorize the output]:color options:(always never auto)'
'-h[Display syntax for the given operation]' {-h,--help}'[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/' {-r,--root}'[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]' {-v,--verbose}'[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/' '--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files' '--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files' '--logfile[An alternate log file]:config file:_files'
@ -34,43 +34,43 @@ _pacman_opts_common=(
# options for passing to _arguments: options for --upgrade commands # options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=( _pacman_opts_pkgfile=(
'-d[Skip dependency checks]' '*-d[Skip dependency checks]'
'*--nodeps[Skip dependency checks]'
'--dbonly[Only remove database entry, do not remove files]' '--dbonly[Only remove database entry, do not remove files]'
'--force[Overwrite conflicting files]' '--force[Overwrite conflicting files]'
'--needed[Do not reinstall up to date packages]' '--needed[Do not reinstall up to date packages]'
'--recursive[Reinstall all dependencies of target packages]'
'*:package file:_files -g "*.pkg.tar*(.)"' '*:package file:_files -g "*.pkg.tar*(.)"'
) )
# options for passing to _arguments: subactions for --query command # options for passing to _arguments: subactions for --query command
_pacman_opts_query_actions=( _pacman_opts_query_actions=(
'-Q' '-Q'
'-g[View all members of a package group]:*:package groups:->query_group' {-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files' {-o,--owns}'[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file' {-p,--file}'[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search' {-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
) )
# options for passing to _arguments: options for --query and subcommands # options for passing to _arguments: options for --query and subcommands
_pacman_opts_query_modifiers=( _pacman_opts_query_modifiers=(
'-c[List package changelog]' {-c,--changelog}'[List package changelog]'
'-d[List packages installed as dependencies]' {-d,--deps}'[List packages installed as dependencies]'
'-e[List packages explicitly installed]' {-e,--explicit}'[List packages explicitly installed]'
'*-i[View package information]' {\*-i,\*--info}'[View package information]'
'*-k[Check package files]' {\*-k,\*--check}'[Check package files]'
'-l[List package contents]' {-l,--list}'[List package contents]'
'-m[List installed packages not found in sync db(s)]' {-m,--foreign}'[List installed packages not found in sync db(s)]'
'-n[List installed packages found in sync db(s)]' {-n,--native}'[List installed packages found in sync db(s)]'
'-t[List packages not required by any package]' {-t,--unrequired}'[List packages not required by any package]'
'-u[List packages that can be upgraded]' {-u,--upgrades}'[List packages that can be upgraded]'
) )
# options for passing to _arguments: options for --remove command # options for passing to _arguments: options for --remove command
_pacman_opts_remove=( _pacman_opts_remove=(
'-c[Remove all dependent packages]' {-c,--cascade}'[Remove all dependent packages]'
'*-d[Skip dependency checks]' {*-d,*--nodeps}'[Skip dependency checks]'
'-n[Remove protected configuration files]' {-n,--nosave}'[Remove protected configuration files]'
'*-s[Remove dependencies not required by other packages]' {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
'--dbonly[Only remove database entry, do not remove files]' '--dbonly[Only remove database entry, do not remove files]'
'*:installed package:_pacman_completions_installed_packages' '*:installed package:_pacman_completions_installed_packages'
) )
@ -84,9 +84,9 @@ _pacman_opts_database=(
# options for passing to _arguments: options for --sync command # options for passing to _arguments: options for --sync command
_pacman_opts_sync_actions=( _pacman_opts_sync_actions=(
'-S' '-S'
'*-c[Remove old packages from cache]:*:clean:->sync_clean' {\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group' {-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search' {-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
'--dbonly[Only remove database entry, do not remove files]' '--dbonly[Only remove database entry, do not remove files]'
'--needed[Do not reinstall up to date packages]' '--needed[Do not reinstall up to date packages]'
'--recursive[Reinstall all dependencies of target packages]' '--recursive[Reinstall all dependencies of target packages]'
@ -94,17 +94,15 @@ _pacman_opts_sync_actions=(
# options for passing to _arguments: options for --sync command # options for passing to _arguments: options for --sync command
_pacman_opts_sync_modifiers=( _pacman_opts_sync_modifiers=(
'*-d[Skip dependency checks]' {\*-d,\*--nodeps}'[Skip dependency checks]'
'*-i[View package information]' {\*-i,\*--info}'[View package information]'
'-l[List all packages in a repository]' {-l,--list}'[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]' {-p,--print}'[Print download URIs for each package to be installed]'
'*-u[Upgrade all out-of-date packages]' {\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
'-w[Download packages only]' {-w,--downloadonly}'[Download packages only]'
'*-y[Download fresh package databases]' {\*-y,\*--refresh}'[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package: '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
_pacman_completions_all_packages' '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
'*--ignoregroup[Ignore a group upgrade]:package group:
_pacman_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]' '--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]' '--asexplicit[Install packages as explicitly installed]'
'--force[Overwrite conflicting files]' '--force[Overwrite conflicting files]'
@ -353,7 +351,9 @@ _pacman_zsh_comp() {
_pacman_action_remove _pacman_action_remove
;; ;;
S*c*) # no completion S*c*) # no completion
return 0 _arguments -s \
'-c' \
"$_pacman_opts_common[@]"
;; ;;
S*l*) # repos S*l*) # repos
_arguments -s : \ _arguments -s : \