mirror of
https://github.com/Jguer/yay.git
synced 2025-10-04 00:03:11 -04:00
Fix zsh completions
Signed-off-by: Jguer <me@jguer.space>
This commit is contained in:
parent
b715c1f223
commit
686509efe3
619
completions/zsh
619
completions/zsh
@ -184,403 +184,380 @@ _pacman_opts_sync_modifiers=(
|
|||||||
|
|
||||||
# handles --help subcommand
|
# handles --help subcommand
|
||||||
_pacman_action_help() {
|
_pacman_action_help() {
|
||||||
_arguments -s : "$_pacman_opts_commands[@]"
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_commands[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles cases where no subcommand has yet been given
|
# handles cases where no subcommand has yet been given
|
||||||
_pacman_action_none() {
|
_pacman_action_none() {
|
||||||
_arguments -s : "$_pacman_opts_commands[@]"
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_commands[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --query subcommand
|
# handles --query subcommand
|
||||||
_pacman_action_query() {
|
_pacman_action_query() {
|
||||||
local context state line
|
local context state line
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
query_file)
|
query_file)
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
|
||||||
query_group)
|
;;
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:groups:_pacman_completions_installed_groups'
|
query_group)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
query_owner)
|
'*:groups:_pacman_completions_installed_groups'
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:file:_files'
|
;;
|
||||||
|
query_owner)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
query_search)
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:search text: '
|
'*:file:_files'
|
||||||
|
;;
|
||||||
|
query_search)
|
||||||
|
_arguments -s : \
|
||||||
*)
|
"$_pacman_opts_common[@]" \
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_actions[@]" "$_pacman_opts_query_modifiers[@]" '*:package:_pacman_completions_installed_packages'
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:search text: '
|
||||||
|
;;
|
||||||
|
*)
|
||||||
esac
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_actions[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:package:_pacman_completions_installed_packages'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --remove subcommand
|
# handles --remove subcommand
|
||||||
_pacman_action_remove() {
|
_pacman_action_remove() {
|
||||||
_arguments -s : '(--remove -R)'{-R,--remove} "$_pacman_opts_common[@]" "$_pacman_opts_remove[@]"
|
_arguments -s : \
|
||||||
|
'(--remove -R)'{-R,--remove} \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_remove[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --database subcommand
|
# handles --database subcommand
|
||||||
_pacman_action_database() {
|
_pacman_action_database() {
|
||||||
_arguments -s : '(--database -D)'{-D,--database} "$_pacman_opts_common[@]" "$_pacman_opts_database[@]"
|
_arguments -s : \
|
||||||
|
'(--database -D)'{-D,--database} \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_database[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --files subcommand
|
# handles --files subcommand
|
||||||
_pacman_action_files() {
|
_pacman_action_files() {
|
||||||
_arguments -s : '(--files -F)'{-F,--files} "$_pacman_opts_common[@]" "$_pacman_opts_files[@]"
|
_arguments -s : \
|
||||||
|
'(--files -F)'{-F,--files} \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_files[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
_pacman_action_deptest () {
|
_pacman_action_deptest () {
|
||||||
_arguments -s : '(--deptest)-T' "$_pacman_opts_common[@]" ":packages:_pacman_all_packages"
|
_arguments -s : \
|
||||||
|
'(--deptest)-T' \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
":packages:_pacman_all_packages"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# handles --sync subcommand
|
# handles --sync subcommand
|
||||||
_pacman_action_sync() {
|
_pacman_action_sync() {
|
||||||
local context state line
|
local context state line
|
||||||
typeset -A opt_args
|
typeset -A opt_args
|
||||||
if (( $+words[(r)--clean] ))
|
if (( $+words[(r)--clean] )); then
|
||||||
then
|
|
||||||
state=sync_clean
|
state=sync_clean
|
||||||
elif (( $+words[(r)--groups] ))
|
elif (( $+words[(r)--groups] )); then
|
||||||
then
|
|
||||||
state=sync_group
|
state=sync_group
|
||||||
elif (( $+words[(r)--search] ))
|
elif (( $+words[(r)--search] )); then
|
||||||
then
|
|
||||||
state=sync_search
|
state=sync_search
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
sync_clean)
|
sync_clean)
|
||||||
_arguments -s : {\*-c,\*--clean}'[Remove old packages from cache]' "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]"
|
_arguments -s : \
|
||||||
|
{\*-c,\*--clean}'[Remove old packages from cache]' \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]"
|
||||||
sync_group)
|
;;
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]" '(-g --group)'{-g,--groups} '*:package group:_pacman_completions_all_groups'
|
sync_group)
|
||||||
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
sync_search)
|
'(-g --group)'{-g,--groups} \
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]" '*:search text: '
|
'*:package group:_pacman_completions_all_groups'
|
||||||
|
;;
|
||||||
|
sync_search)
|
||||||
|
_arguments -s : \
|
||||||
*)
|
"$_pacman_opts_common[@]" \
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_actions[@]" "$_pacman_opts_sync_modifiers[@]" '*:package:_pacman_completions_all_packages'
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:search text: '
|
||||||
|
;;
|
||||||
|
*)
|
||||||
esac
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_actions[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:package:_pacman_completions_all_packages'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --upgrade subcommand
|
# handles --upgrade subcommand
|
||||||
_pacman_action_upgrade() {
|
_pacman_action_upgrade() {
|
||||||
_arguments -s : '(-U --upgrade)'{-U,--upgrade} "$_pacman_opts_common[@]" "$_pacman_opts_pkgfile[@]"
|
_arguments -s : \
|
||||||
|
'(-U --upgrade)'{-U,--upgrade} \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_pkgfile[@]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# handles --version subcommand
|
# handles --version subcommand
|
||||||
_pacman_action_version() {
|
_pacman_action_version() {
|
||||||
# no further arguments
|
# no further arguments
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# provides completions for package groups
|
# provides completions for package groups
|
||||||
_pacman_completions_all_groups() {
|
_pacman_completions_all_groups() {
|
||||||
local -a cmd groups
|
local -a cmd groups
|
||||||
_pacman_get_command
|
_pacman_get_command
|
||||||
groups=( $(_call_program groups $cmd[@] -Sg) )
|
groups=( $(_call_program groups $cmd[@] -Sg) )
|
||||||
typeset -U groups
|
typeset -U groups
|
||||||
|
|
||||||
if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]
|
if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then
|
||||||
then
|
|
||||||
_sequence compadd -S ',' "$@" -a groups
|
_sequence compadd -S ',' "$@" -a groups
|
||||||
else
|
else
|
||||||
compadd "$@" -a groups
|
compadd "$@" -a groups
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# provides completions for packages available from repositories
|
||||||
|
# these can be specified as either 'package' or 'repository/package'
|
||||||
|
_pacman_completions_all_packages() {
|
||||||
|
local -a seq sep cmd packages repositories packages_long
|
||||||
|
|
||||||
|
if [[ ${words[CURRENT-1]} == '--ignore' ]]; then
|
||||||
|
seq='_sequence'
|
||||||
|
sep=(-S ',')
|
||||||
|
else
|
||||||
|
seq=
|
||||||
|
sep=()
|
||||||
|
fi
|
||||||
|
|
||||||
|
if compset -P1 '*/*'; then
|
||||||
|
packages=( $(_call_program packages yay -Pc ${words[CURRENT]%/*}) )
|
||||||
|
typeset -U packages
|
||||||
|
${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
|
||||||
|
else
|
||||||
|
packages=( $(_call_program packages yay -Pc ) )
|
||||||
|
typeset -U packages
|
||||||
|
${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
|
||||||
|
|
||||||
|
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
||||||
|
typeset -U repositories
|
||||||
|
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# provides completions for package groups
|
||||||
|
_pacman_completions_installed_groups() {
|
||||||
|
local -a cmd groups
|
||||||
|
_pacman_get_command
|
||||||
|
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
|
||||||
|
typeset -U groups
|
||||||
|
compadd "$@" -a groups
|
||||||
|
}
|
||||||
|
|
||||||
|
# provides completions for installed packages
|
||||||
|
_pacman_completions_installed_packages() {
|
||||||
|
local -a cmd packages packages_long
|
||||||
|
packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
|
||||||
|
packages_long=(/var/lib/pacman/local/*(/))
|
||||||
|
compadd "$@" -a packages
|
||||||
|
}
|
||||||
|
|
||||||
|
_pacman_all_packages() {
|
||||||
|
_alternative : \
|
||||||
|
'localpkgs:local packages:_pacman_completions_installed_packages' \
|
||||||
|
'repopkgs:repository packages:_pacman_completions_all_packages'
|
||||||
|
}
|
||||||
|
|
||||||
|
# provides completions for repository names
|
||||||
|
_pacman_completions_repositories() {
|
||||||
|
local -a cmd repositories
|
||||||
|
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
||||||
|
# Uniq the array
|
||||||
|
typeset -U repositories
|
||||||
|
compadd "$@" -a repositories
|
||||||
|
}
|
||||||
|
|
||||||
|
# builds command for invoking pacman in a _call_program command - extracts
|
||||||
|
# relevant options already specified (config file, etc)
|
||||||
|
# $cmd must be declared by calling function
|
||||||
|
_pacman_get_command() {
|
||||||
|
# this is mostly nicked from _perforce
|
||||||
|
cmd=( "pacman" "2>/dev/null")
|
||||||
|
integer i
|
||||||
|
for (( i = 2; i < CURRENT - 1; i++ )); do
|
||||||
|
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
|
||||||
|
cmd+=( ${words[i,i+1]} )
|
||||||
fi
|
fi
|
||||||
}
|
done
|
||||||
|
|
||||||
# provides completions for packages available from repositories
|
|
||||||
# these can be specified as either 'package' or 'repository/package'
|
|
||||||
_pacman_completions_all_packages() {
|
|
||||||
local -a seq sep cmd packages repositories packages_long
|
|
||||||
|
|
||||||
if [[ ${words[CURRENT-1]} == '--ignore' ]]
|
|
||||||
then
|
|
||||||
seq='_sequence'
|
|
||||||
sep=(-S ',')
|
|
||||||
else
|
|
||||||
seq=
|
|
||||||
sep=()
|
|
||||||
fi
|
|
||||||
|
|
||||||
if compset -P1 '*/*'
|
|
||||||
then
|
|
||||||
packages=( $(_call_program packages yay -Pc ${words[CURRENT]%/*}) )
|
|
||||||
typeset -U packages
|
|
||||||
${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
|
|
||||||
else
|
|
||||||
packages=( $(_call_program packages yay -Pc ) )
|
|
||||||
typeset -U packages
|
|
||||||
${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
|
|
||||||
|
|
||||||
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
|
||||||
typeset -U repositories
|
|
||||||
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# provides completions for package groups
|
|
||||||
_pacman_completions_installed_groups() {
|
|
||||||
local -a cmd groups
|
|
||||||
_pacman_get_command
|
|
||||||
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
|
|
||||||
typeset -U groups
|
|
||||||
compadd "$@" -a groups
|
|
||||||
}
|
|
||||||
|
|
||||||
# provides completions for installed packages
|
|
||||||
_pacman_completions_installed_packages() {
|
|
||||||
local -a cmd packages packages_long
|
|
||||||
packages_long=(/var/lib/pacman/local/*(/))
|
|
||||||
packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
|
|
||||||
compadd "$@" -a packages
|
|
||||||
}
|
|
||||||
|
|
||||||
_pacman_all_packages() {
|
|
||||||
_alternative : 'localpkgs:local packages:_pacman_completions_installed_packages' 'repopkgs:repository packages:_pacman_completions_all_packages'
|
|
||||||
}
|
|
||||||
|
|
||||||
# provides completions for repository names
|
|
||||||
_pacman_completions_repositories() {
|
|
||||||
local -a cmd repositories
|
|
||||||
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
|
|
||||||
# Uniq the array
|
|
||||||
typeset -U repositories
|
|
||||||
compadd "$@" -a repositories
|
|
||||||
}
|
|
||||||
|
|
||||||
# builds command for invoking pacman in a _call_program command - extracts
|
|
||||||
# relevant options already specified (config file, etc)
|
|
||||||
# $cmd must be declared by calling function
|
|
||||||
_pacman_get_command() {
|
|
||||||
# this is mostly nicked from _perforce
|
|
||||||
cmd=( "pacman" "2>/dev/null")
|
|
||||||
integer i
|
|
||||||
for (( i = 2; i < CURRENT - 1; i++ ))
|
|
||||||
; do
|
|
||||||
if [[ ${words[i]} = "--config" |
|
|
||||||
| ${words[i]} = "--root" ]]
|
|
||||||
then
|
|
||||||
cmd+=( ${words[i,i+1]} )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# main dispatcher
|
# main dispatcher
|
||||||
_pacman_zsh_comp() {
|
_pacman_zsh_comp() {
|
||||||
local -a args cmds
|
local -a args cmds;
|
||||||
|
local tmp
|
||||||
local tmp
|
args=( ${${${(M)words:#-*}#-}:#-*} )
|
||||||
args=( ${${${(M)words:#-*}#-}:#-*} )
|
for tmp in $words; do
|
||||||
for tmp in $words
|
|
||||||
do
|
|
||||||
cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
|
cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
|
||||||
done
|
done
|
||||||
case $args in #$words[2] in
|
case $args in #$words[2] in
|
||||||
h*)
|
h*)
|
||||||
if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 ))
|
if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
|
||||||
then
|
_pacman_action_help
|
||||||
_pacman_action_help
|
else
|
||||||
else
|
_message "no more arguments"
|
||||||
_message "no more arguments"
|
fi
|
||||||
fi
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*h*)
|
*h*)
|
||||||
_message "no more arguments"
|
_message "no more arguments"
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
D*)
|
D*)
|
||||||
_pacman_action_database
|
_pacman_action_database
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
F*)
|
F*)
|
||||||
_pacman_action_files
|
_pacman_action_files
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
Q*g*) # ipkg groups
|
Q*g*) # ipkg groups
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:groups:_pacman_completions_installed_groups'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:groups:_pacman_completions_installed_groups'
|
||||||
|
;;
|
||||||
Q*o*) # file
|
Q*o*) # file
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:package file:_files'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:package file:_files'
|
||||||
|
;;
|
||||||
Q*p*) # file *.pkg.tar*
|
Q*p*) # file *.pkg.tar*
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_query_modifiers[@]" '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_query_modifiers[@]" \
|
||||||
|
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
|
||||||
|
;;
|
||||||
T*)
|
T*)
|
||||||
_pacman_action_deptest
|
_pacman_action_deptest
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
Q*)
|
Q*)
|
||||||
_pacman_action_query
|
_pacman_action_query
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
P*)
|
P*)
|
||||||
_arguments -s : "$_pacman_opts_print_modifiers[@]"
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_print_modifiers[@]"
|
||||||
|
;;
|
||||||
|
|
||||||
R*)
|
R*)
|
||||||
_pacman_action_remove
|
_pacman_action_remove
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
S*c*) # no completion
|
S*c*) # no completion
|
||||||
_arguments -s : '(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' "$_pacman_opts_common[@]"
|
_arguments -s : \
|
||||||
|
'(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
|
||||||
|
"$_pacman_opts_common[@]"
|
||||||
|
;;
|
||||||
S*l*) # repos
|
S*l*) # repos
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]" '*:package repo:_pacman_completions_repositories'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:package repo:_pacman_completions_repositories' \
|
||||||
|
;;
|
||||||
S*g*) # pkg groups
|
S*g*) # pkg groups
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]" '*:package group:_pacman_completions_all_groups'
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:package group:_pacman_completions_all_groups'
|
||||||
|
;;
|
||||||
S*s*)
|
S*s*)
|
||||||
_arguments -s : "$_pacman_opts_common[@]" "$_pacman_opts_sync_modifiers[@]" '*:search text: '
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
"$_pacman_opts_sync_modifiers[@]" \
|
||||||
|
'*:search text: '
|
||||||
|
;;
|
||||||
S*)
|
S*)
|
||||||
_pacman_action_sync
|
_pacman_action_sync
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
T*)
|
T*)
|
||||||
_arguments -s : '-T' "$_pacman_opts_common[@]" ":packages:_pacman_all_packages"
|
_arguments -s : \
|
||||||
|
'-T' \
|
||||||
|
"$_pacman_opts_common[@]" \
|
||||||
|
":packages:_pacman_all_packages"
|
||||||
|
;;
|
||||||
U*)
|
U*)
|
||||||
_pacman_action_upgrade
|
_pacman_action_upgrade
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
V*)
|
V*)
|
||||||
_pacman_action_version
|
_pacman_action_version
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
Y*)
|
Y*)
|
||||||
_arguments -s : "$_pacman_opts_yay_modifiers[@]"
|
_arguments -s : \
|
||||||
|
"$_pacman_opts_yay_modifiers[@]"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
case ${(M)words:#--*} in
|
case ${(M)words:#--*} in
|
||||||
*--help*)
|
*--help*)
|
||||||
if (( ${(w)#cmds} == 1 ))
|
if (( ${(w)#cmds} == 1 )); then
|
||||||
then
|
_pacman_action_help
|
||||||
_pacman_action_help
|
else
|
||||||
else
|
return 0;
|
||||||
return 0
|
fi
|
||||||
|
;;
|
||||||
fi
|
*--sync*)
|
||||||
|
_pacman_action_sync
|
||||||
|
;;
|
||||||
|
*--query*)
|
||||||
*--sync*)
|
_pacman_action_query
|
||||||
_pacman_action_sync
|
;;
|
||||||
|
*--remove*)
|
||||||
|
_pacman_action_remove
|
||||||
|
;;
|
||||||
*--query*)
|
*--deptest*)
|
||||||
_pacman_action_query
|
_pacman_action_deptest
|
||||||
|
;;
|
||||||
|
*--database*)
|
||||||
|
_pacman_action_database
|
||||||
*--remove*)
|
;;
|
||||||
_pacman_action_remove
|
*--files*)
|
||||||
|
_pacman_action_files
|
||||||
|
;;
|
||||||
|
*--version*)
|
||||||
*--deptest*)
|
_pacman_action_version
|
||||||
_pacman_action_deptest
|
;;
|
||||||
|
*--upgrade*)
|
||||||
|
_pacman_action_upgrade
|
||||||
|
;;
|
||||||
*--database*)
|
*)
|
||||||
_pacman_action_database
|
_pacman_action_none
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
*--files*)
|
esac
|
||||||
_pacman_action_files
|
}
|
||||||
|
_pacman_comp() {
|
||||||
|
case "$service" in
|
||||||
|
yay)
|
||||||
*--version*)
|
_pacman_zsh_comp "$@"
|
||||||
_pacman_action_version
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*--upgrade*)
|
|
||||||
_pacman_action_upgrade
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
_pacman_action_none
|
_message "Error"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
_pacman_comp() {
|
|
||||||
case "$service" in
|
|
||||||
yay)
|
|
||||||
_pacman_zsh_comp "$@"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*)
|
|
||||||
_message "Error"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_pacman_comp "$@"
|
_pacman_comp "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user