Update zsh completion for pacman 5

also include updates from pacman 4.2

https://bugs.archlinux.org/task/47559

Original-patch-by: Boris Staletic <bstaletic@archlinux.net>
Signed-off-by: Daniel Wallace <danielwallace@gtmanfred.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Daniel Wallace 2016-01-28 17:20:03 +00:00 committed by Allan McRae
parent 6ea97963b3
commit 9604570add
1 changed files with 39 additions and 2 deletions

View File

@ -8,6 +8,7 @@ setopt extendedglob
# options for passing to _arguments: main pacman commands # options for passing to _arguments: main pacman commands
_pacman_opts_commands=( _pacman_opts_commands=(
{-D,--database}'[Modify database]' {-D,--database}'[Modify database]'
{-F,--files}'[Query the files database]'
{-Q,--query}'[Query the package database]' {-Q,--query}'[Query the package database]'
{-R,--remove}'[Remove a package from the system]' {-R,--remove}'[Remove a package from the system]'
{-S,--sync}'[Synchronize packages]' {-S,--sync}'[Synchronize packages]'
@ -19,6 +20,7 @@ _pacman_opts_commands=(
# 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=(
'--arch[Set an alternate architecture]'
{-b,--dbpath}'[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,--help}'[Display syntax for the given operation]' {-h,--help}'[Display syntax for the given operation]'
@ -26,11 +28,14 @@ _pacman_opts_common=(
{-v,--verbose}'[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'
'--confirm[Always ask for confirmation]'
'--debug[Display debug messages]'
'--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
'--hookdir[Set an alternate hook location]: :_files -/'
'--logfile[An alternate log file]:config file:_files' '--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]' '--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]' '--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]' '--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
) )
# options for passing to _arguments: options for --upgrade commands # options for passing to _arguments: options for --upgrade commands
@ -43,6 +48,10 @@ _pacman_opts_pkgfile=(
'--needed[Do not reinstall up to date packages]' '--needed[Do not reinstall up to date packages]'
'--asdeps[mark packages as non-explicitly installed]' '--asdeps[mark packages as non-explicitly installed]'
'--asexplicit[mark packages as explicitly installed]' '--asexplicit[mark packages as explicitly installed]'
{-p,--print}'[Only print the targets instead of performing the operation]'
'*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
'--print-format[Specify how the targets should be printed]'
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"' '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
) )
@ -73,11 +82,14 @@ _pacman_opts_query_modifiers=(
# 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,--cascade}'[Remove all dependent packages]' {-c,--cascade}'[Remove all dependent packages]'
{*-d,*--nodeps}'[Skip dependency checks]' {-d,--nodeps}'[Skip dependency checks]'
'*--assume-installed[Add virtual package to satisfy dependencies]' '*--assume-installed[Add virtual package to satisfy dependencies]'
{-n,--nosave}'[Remove protected configuration files]' {-n,--nosave}'[Remove protected configuration files]'
{-p,--print}'[Only print the targets instead of performing the operation]'
{\*-s,\*--recursive}'[Remove dependencies not required by other packages]' {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
{-u,--unneeded}'[Remove unneeded packages]'
'--dbonly[Only remove database entry, do not remove files]' '--dbonly[Only remove database entry, do not remove files]'
'--print-format[Specify how the targets should be printed]'
'*:installed package:_pacman_completions_installed_packages' '*:installed package:_pacman_completions_installed_packages'
) )
@ -87,6 +99,16 @@ _pacman_opts_database=(
'*:installed package:_pacman_completions_installed_packages' '*:installed package:_pacman_completions_installed_packages'
) )
_pacman_opts_files=(
{-l,--list}'[List the files owned by the queried package]:package:_pacman_completions_all_packages'
{-o,--owns}'[Query the package that owns]:files:_files'
{-s,--search}'[Search package file names for matching strings]:files:_files'
{-x,--regex}'[Enable searching using regluar expressions]:regex:'
{-y,--refresh}'[Download fresh files databases from the server]'
'--machinereadable[Produce machine-readable output]'
{-q,--quiet}'[Show less information for query and search]'
)
# 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 --sync)'{-S,--sync} '(-S --sync)'{-S,--sync}
@ -114,6 +136,7 @@ _pacman_opts_sync_modifiers=(
'--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]'
'--print-format[Specify how the targets should be printed]'
) )
# handles --help subcommand # handles --help subcommand
@ -184,6 +207,14 @@ _pacman_action_database() {
"$_pacman_opts_database[@]" "$_pacman_opts_database[@]"
} }
# handles --files subcommand
_pacman_action_files() {
_arguments -s : \
'(--files -F)'{-F,--files} \
"$_pacman_opts_common[@]" \
"$_pacman_opts_files[@]"
}
_pacman_action_deptest () { _pacman_action_deptest () {
_arguments -s : \ _arguments -s : \
'(--deptest)-T' \ '(--deptest)-T' \
@ -359,6 +390,9 @@ _pacman_zsh_comp() {
D*) D*)
_pacman_action_database _pacman_action_database
;; ;;
F*)
_pacman_action_files
;;
Q*g*) # ipkg groups Q*g*) # ipkg groups
_arguments -s : \ _arguments -s : \
"$_pacman_opts_common[@]" \ "$_pacman_opts_common[@]" \
@ -449,6 +483,9 @@ _pacman_zsh_comp() {
*--database*) *--database*)
_pacman_action_database _pacman_action_database
;; ;;
*--files*)
_pacman_action_files
;;
*--version*) *--version*)
_pacman_action_version _pacman_action_version
;; ;;