zsh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. #compdef yay
  2. # vim:fdm=marker foldlevel=0 tabstop=2 shiftwidth=2 filetype=zsh
  3. typeset -A opt_args
  4. setopt extendedglob
  5. # options for passing to _arguments: main pacman commands
  6. _pacman_opts_commands=(
  7. {-D,--database}'[Modify database]'
  8. {-F,--files}'[Query the files database]'
  9. {-G,--getpkgbuild}'[Get PKGBUILD from ABS or AUR]'
  10. {-Q,--query}'[Query the package database]'
  11. {-R,--remove}'[Remove a package from the system]'
  12. {-P,--print}'[Print yay information]'
  13. {-S,--sync}'[Synchronize packages]'
  14. {-T,--deptest}'[Check if dependencies are installed]'
  15. {-U,--upgrade}'[Upgrade a package]'
  16. {-Y,--yay}'[Yay specific options]'
  17. {-V,--version}'[Display version and exit]'
  18. '(-h --help)'{-h,--help}'[Display usage]'
  19. )
  20. # options for passing to _arguments: options common to all commands
  21. _pacman_opts_common=(
  22. '--repo[Assume targets are from the repositories]'
  23. {-a,--aur}'[Assume targets are from the AUR]'
  24. '--aururl[Set an alternative AUR URL]:url'
  25. '--arch[Set an alternate architecture]'
  26. {-b,--dbpath}'[Alternate database location]:database_location:_files -/'
  27. '--color[colorize the output]:color options:(always never auto)'
  28. {-h,--help}'[Display syntax for the given operation]'
  29. {-r,--root}'[Set alternate installation root]:installation root:_files -/'
  30. {-v,--verbose}'[Be more verbose]'
  31. '--cachedir[Alternate package cache location]:cache_location:_files -/'
  32. '--config[An alternate configuration file]:config file:_files'
  33. '--makepkgconf[makepkg.conf file to use]:config file:_files'
  34. '--nomakepkgconf[Use the default makepkg.conf]'
  35. '--requestsplitn[Max amount of packages to query per AUR request]:number'
  36. '--completioninterval[Time in days to to refresh completion cache]:number'
  37. '--confirm[Always ask for confirmation]'
  38. '--debug[Display debug messages]'
  39. '--gpgdir[Set an alternate directory for GnuPG (instead of /etc/pacman.d/gnupg)]: :_files -/'
  40. '--hookdir[Set an alternate hook location]: :_files -/'
  41. '--logfile[An alternate log file]:config file:_files'
  42. '--noconfirm[Do not ask for confirmation]'
  43. '--noprogressbar[Do not show a progress bar when downloading files]'
  44. '--noscriptlet[Do not execute the install scriptlet if one exists]'
  45. '--save[Causes config options to be saved back to the config file]'
  46. '--builddir[Directory to use for building AUR Packages]:build dir:_files -/'
  47. '--editor[Editor to use when editing PKGBUILDs]:editor:_files'
  48. '--editorflags[Flags to pass to editor]'
  49. '--makepkg[makepkg command to use]:makepkg:_files'
  50. '--pacman[pacman command to use]:pacman:_files'
  51. '--tar[bsdtar command to use]:tar:_files'
  52. '--git[git command to use]:git:_files'
  53. '--gpg[gpg command to use]:gpg:_files'
  54. '--sortby[Sort AUR results by a specific field during search]:sortby options:(votes popularity id baseid name base submitted modified)'
  55. '--answerclean[Set a predetermined answer for the clean build menu]:answer'
  56. '--answeredit[Set a predetermined answer for the edit pkgbuild menu]:answer'
  57. '--answerupgrade[Set a predetermined answer for the upgrade menu]:answer'
  58. '--noanswerclean[Unset the answer for the clean build menu]'
  59. '--noansweredit[Unset the answer for the edit pkgbuild menu]'
  60. '--noanswerupgrade[Unset the answer for the upgrade menu]'
  61. '--cleanmenu[Give the option to clean build PKGBUILDS]'
  62. '--diffmenu[Give the option to show diffs for build files]'
  63. '--editmenu[Give the option to edit/view PKGBUILDS]'
  64. '--upgrademenu[Show a detailed list of updates with the option to skip any]'
  65. "--nocleanmenu[Don't clean build PKGBUILDS]"
  66. "--nodiffmenu[Don't show diffs for build files]"
  67. "--noeditmenu[Don't edit/view PKGBUILDS]"
  68. "--noupgrademenu[Don't show the upgrade menu]"
  69. "--askremovemake[Ask to remove makedepends after install]"
  70. "--removemake[Remove makedepends after install]"
  71. "--noremovemake[Don't remove makedepends after install]"
  72. '--bottomup[Show AUR packages first]'
  73. '--topdown[Show repository packages first]'
  74. '--devel[Check -git/-svn/-hg development version]'
  75. '--nodevel[Disable development version checking]'
  76. '--afterclean[Clean package sources after successful build]'
  77. '--noafterclean[Disable package sources cleaning after successful build]'
  78. '--timeupdate[Check packages modification date and version]'
  79. '--notimeupdate[Check only package version change]'
  80. '--redownload[Always download pkgbuilds of targets]'
  81. '--redownloadall[Always download pkgbuilds of all AUR packages]'
  82. '--noredownload[Skip pkgbuild download if in cache and up to date]'
  83. '--rebuild[Always build target packages]'
  84. '--rebuildall[Always build all AUR packages]'
  85. '--provides[Look for matching provders when searching for packages]'
  86. '--noprovides[Just look for packages by pkgname]'
  87. '--pgpfetch[Prompt to import PGP keys from PKGBUILDs]'
  88. "--nopgpfetch[Don't prompt to import PGP keys]"
  89. "--useask[Automatically resolve conflicts using pacman's ask flag]"
  90. '--nouseask[Confirm conflicts manually during the install]'
  91. '--combinedupgrade[Refresh then perform the repo and AUR upgrade together]'
  92. '--nocombinedupgrade[Perform the repo upgrade and AUR upgrade separately]'
  93. '--rebuildtree[Always build all AUR packages even if installed]'
  94. '--norebuild[Skip package build if in cache and up to date]'
  95. '--mflags[Pass arguments to makepkg]:mflags'
  96. '--gpgflags[Pass arguments to gpg]:gpgflags'
  97. '--sudoloop[Loop sudo calls in the background to avoid timeout]'
  98. '--nosudoloop[Do not loop sudo calls in the backgrount]'
  99. )
  100. # options for passing to _arguments: options for --upgrade commands
  101. _pacman_opts_pkgfile=(
  102. '*-d[Skip dependency checks]'
  103. '*--nodeps[Skip dependency checks]'
  104. '*--assume-installed[Add virtual package to satisfy dependencies]'
  105. '--dbonly[Only remove database entry, do not remove files]'
  106. '--force[Overwrite conflicting files]'
  107. '--needed[Do not reinstall up to date packages]'
  108. '--asdeps[mark packages as non-explicitly installed]'
  109. '--asexplicit[mark packages as explicitly installed]'
  110. {-p,--print}'[Only print the targets instead of performing the operation]'
  111. '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
  112. '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
  113. '--print-format[Specify how the targets should be printed]'
  114. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  115. )
  116. # options for passing to _arguments: subactions for --query command
  117. _pacman_opts_query_actions=(
  118. '(-Q --query)'{-Q,--query}
  119. {-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
  120. {-o,--owns}'[Query the package that owns a file]:file:_files'
  121. {-p,--file}'[Package file to query]:*:package file:->query_file'
  122. {-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
  123. )
  124. # options for passing to _arguments: options for --query and subcommands
  125. _pacman_opts_query_modifiers=(
  126. {-c,--changelog}'[List package changelog]'
  127. {-d,--deps}'[List packages installed as dependencies]'
  128. {-e,--explicit}'[List packages explicitly installed]'
  129. {\*-i,\*--info}'[View package information]'
  130. {\*-k,\*--check}'[Check package files]'
  131. {-l,--list}'[List package contents]'
  132. {-m,--foreign}'[List installed packages not found in sync db(s)]'
  133. {-n,--native}'[List installed packages found in sync db(s)]'
  134. {-q,--quiet}'[Show less information for query and search]'
  135. {-t,--unrequired}'[List packages not required by any package]'
  136. {-u,--upgrades}'[List packages that can be upgraded]'
  137. )
  138. # -Y
  139. _pacman_opts_yay_modifiers=(
  140. {-c,--clean}'[Remove unneeded dependencies]'
  141. '--gendb[Generates development package DB used for updating]'
  142. )
  143. # -P
  144. _pacman_opts_print_modifiers=(
  145. {-c,--complete}'[Used for completions]'
  146. {-d,--defaultconfig}'[Print default yay configuration]'
  147. {-g,--config}'[Print current yay configuration]'
  148. {-n,--numberupgrades}'[Print number of updates]'
  149. {-s,--stats}'[Display system package statistics]'
  150. {-u,--upgrades}'[Print update list]'
  151. {-w,--news}'[Print arch news]'
  152. )
  153. # options for passing to _arguments: options for --remove command
  154. _pacman_opts_remove=(
  155. {-c,--cascade}'[Remove all dependent packages]'
  156. {-d,--nodeps}'[Skip dependency checks]'
  157. '*--assume-installed[Add virtual package to satisfy dependencies]'
  158. {-n,--nosave}'[Remove protected configuration files]'
  159. {-p,--print}'[Only print the targets instead of performing the operation]'
  160. {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
  161. {-u,--unneeded}'[Remove unneeded packages]'
  162. '--dbonly[Only remove database entry, do not remove files]'
  163. '--print-format[Specify how the targets should be printed]'
  164. '*:installed package:_pacman_completions_installed_packages'
  165. )
  166. _pacman_opts_database=(
  167. '--asdeps[mark packages as non-explicitly installed]'
  168. '--asexplicit[mark packages as explicitly installed]'
  169. '*:installed package:_pacman_completions_installed_packages'
  170. )
  171. _pacman_opts_files=(
  172. {-l,--list}'[List the files owned by the queried package]:package:_pacman_completions_all_packages'
  173. {-o,--owns}'[Query the package that owns]:files:_files'
  174. {-s,--search}'[Search package file names for matching strings]:files:_files'
  175. {-x,--regex}'[Enable searching using regular expressions]:regex:'
  176. {-y,--refresh}'[Download fresh files databases from the server]'
  177. '--machinereadable[Produce machine-readable output]'
  178. {-q,--quiet}'[Show less information for query and search]'
  179. )
  180. # options for passing to _arguments: options for --sync command
  181. _pacman_opts_sync_actions=(
  182. '(-S --sync)'{-S,--sync}
  183. {\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
  184. {-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
  185. {-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
  186. '--dbonly[Only remove database entry, do not remove files]'
  187. '--needed[Do not reinstall up to date packages]'
  188. '--recursive[Reinstall all dependencies of target packages]'
  189. )
  190. # options for passing to _arguments: options for --sync command
  191. _pacman_opts_sync_modifiers=(
  192. {\*-d,\*--nodeps}'[Skip dependency checks]'
  193. '*--assume-installed[Add virtual package to satisfy dependencies]'
  194. {\*-i,\*--info}'[View package information]'
  195. {-l,--list}'[List all packages in a repository]'
  196. {-p,--print}'[Print download URIs for each package to be installed]'
  197. {-q,--quiet}'[Show less information for query and search]'
  198. {\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
  199. {-w,--downloadonly}'[Download packages only]'
  200. {\*-y,\*--refresh}'[Download fresh package databases]'
  201. '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
  202. '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
  203. '--asdeps[Install packages as non-explicitly installed]'
  204. '--asexplicit[Install packages as explicitly installed]'
  205. '--force[Overwrite conflicting files]'
  206. '--print-format[Specify how the targets should be printed]'
  207. )
  208. # handles --help subcommand
  209. _pacman_action_help() {
  210. _arguments -s : \
  211. "$_pacman_opts_commands[@]"
  212. }
  213. # handles cases where no subcommand has yet been given
  214. _pacman_action_none() {
  215. _arguments -s : \
  216. "$_pacman_opts_commands[@]"
  217. }
  218. # handles --query subcommand
  219. _pacman_action_query() {
  220. local context state line
  221. typeset -A opt_args
  222. case $state in
  223. query_file)
  224. _arguments -s : \
  225. "$_pacman_opts_common[@]" \
  226. "$_pacman_opts_query_modifiers[@]" \
  227. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  228. ;;
  229. query_group)
  230. _arguments -s : \
  231. "$_pacman_opts_common[@]" \
  232. "$_pacman_opts_query_modifiers[@]" \
  233. '*:groups:_pacman_completions_installed_groups'
  234. ;;
  235. query_owner)
  236. _arguments -s : \
  237. "$_pacman_opts_common[@]" \
  238. "$_pacman_opts_query_modifiers[@]" \
  239. '*:file:_files'
  240. ;;
  241. query_search)
  242. _arguments -s : \
  243. "$_pacman_opts_common[@]" \
  244. "$_pacman_opts_query_modifiers[@]" \
  245. '*:search text: '
  246. ;;
  247. *)
  248. _arguments -s : \
  249. "$_pacman_opts_common[@]" \
  250. "$_pacman_opts_query_actions[@]" \
  251. "$_pacman_opts_query_modifiers[@]" \
  252. '*:package:_pacman_completions_installed_packages'
  253. ;;
  254. esac
  255. }
  256. # handles --remove subcommand
  257. _pacman_action_remove() {
  258. _arguments -s : \
  259. '(--remove -R)'{-R,--remove} \
  260. "$_pacman_opts_common[@]" \
  261. "$_pacman_opts_remove[@]"
  262. }
  263. # handles --database subcommand
  264. _pacman_action_database() {
  265. _arguments -s : \
  266. '(--database -D)'{-D,--database} \
  267. "$_pacman_opts_common[@]" \
  268. "$_pacman_opts_database[@]"
  269. }
  270. # handles --files subcommand
  271. _pacman_action_files() {
  272. _arguments -s : \
  273. '(--files -F)'{-F,--files} \
  274. "$_pacman_opts_common[@]" \
  275. "$_pacman_opts_files[@]"
  276. }
  277. _pacman_action_deptest () {
  278. _arguments -s : \
  279. '(--deptest)-T' \
  280. "$_pacman_opts_common[@]" \
  281. ":packages:_pacman_all_packages"
  282. }
  283. # handles --sync subcommand
  284. _pacman_action_sync() {
  285. local context state line
  286. typeset -A opt_args
  287. if (( $+words[(r)--clean] )); then
  288. state=sync_clean
  289. elif (( $+words[(r)--groups] )); then
  290. state=sync_group
  291. elif (( $+words[(r)--search] )); then
  292. state=sync_search
  293. fi
  294. case $state in
  295. sync_clean)
  296. _arguments -s : \
  297. {\*-c,\*--clean}'[Remove old packages from cache]' \
  298. "$_pacman_opts_common[@]" \
  299. "$_pacman_opts_sync_modifiers[@]"
  300. ;;
  301. sync_group)
  302. _arguments -s : \
  303. "$_pacman_opts_common[@]" \
  304. "$_pacman_opts_sync_modifiers[@]" \
  305. '(-g --group)'{-g,--groups} \
  306. '*:package group:_pacman_completions_all_groups'
  307. ;;
  308. sync_search)
  309. _arguments -s : \
  310. "$_pacman_opts_common[@]" \
  311. "$_pacman_opts_sync_modifiers[@]" \
  312. '*:search text: '
  313. ;;
  314. *)
  315. _arguments -s : \
  316. "$_pacman_opts_common[@]" \
  317. "$_pacman_opts_sync_actions[@]" \
  318. "$_pacman_opts_sync_modifiers[@]" \
  319. '*:package:_pacman_completions_all_packages'
  320. ;;
  321. esac
  322. }
  323. # handles --upgrade subcommand
  324. _pacman_action_upgrade() {
  325. _arguments -s : \
  326. '(-U --upgrade)'{-U,--upgrade} \
  327. "$_pacman_opts_common[@]" \
  328. "$_pacman_opts_pkgfile[@]"
  329. }
  330. # handles --version subcommand
  331. _pacman_action_version() {
  332. # no further arguments
  333. return 0
  334. }
  335. # provides completions for package groups
  336. _pacman_completions_all_groups() {
  337. local -a cmd groups
  338. _pacman_get_command
  339. groups=( $(_call_program groups $cmd[@] -Sg) )
  340. typeset -U groups
  341. if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then
  342. _sequence compadd -S ',' "$@" -a groups
  343. else
  344. compadd "$@" -a groups
  345. fi
  346. }
  347. # provides completions for packages available from repositories
  348. # these can be specified as either 'package' or 'repository/package'
  349. _pacman_completions_all_packages() {
  350. local -a seq sep cmd packages repositories packages_long
  351. if [[ ${words[CURRENT-1]} == '--ignore' ]]; then
  352. seq='_sequence'
  353. sep=(-S ',')
  354. else
  355. seq=
  356. sep=()
  357. fi
  358. if compset -P1 '*/*'; then
  359. packages=( $(_call_program packages yay -Pc ${words[CURRENT]%/*}) )
  360. typeset -U packages
  361. ${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
  362. else
  363. packages=( $(_call_program packages yay -Pc ) )
  364. typeset -U packages
  365. ${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
  366. repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
  367. typeset -U repositories
  368. _wanted repo_packages expl "repository/package" compadd -S "/" $repositories
  369. fi
  370. }
  371. # provides completions for package groups
  372. _pacman_completions_installed_groups() {
  373. local -a cmd groups
  374. _pacman_get_command
  375. groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
  376. typeset -U groups
  377. compadd "$@" -a groups
  378. }
  379. # provides completions for installed packages
  380. _pacman_completions_installed_packages() {
  381. local -a cmd packages packages_long
  382. packages_long=(/var/lib/pacman/local/*(/))
  383. packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
  384. compadd "$@" -a packages
  385. }
  386. _pacman_all_packages() {
  387. _alternative : \
  388. 'localpkgs:local packages:_pacman_completions_installed_packages' \
  389. 'repopkgs:repository packages:_pacman_completions_all_packages'
  390. }
  391. # provides completions for repository names
  392. _pacman_completions_repositories() {
  393. local -a cmd repositories
  394. repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
  395. # Uniq the array
  396. typeset -U repositories
  397. compadd "$@" -a repositories
  398. }
  399. # builds command for invoking pacman in a _call_program command - extracts
  400. # relevant options already specified (config file, etc)
  401. # $cmd must be declared by calling function
  402. _pacman_get_command() {
  403. # this is mostly nicked from _perforce
  404. cmd=( "pacman" "2>/dev/null")
  405. integer i
  406. for (( i = 2; i < CURRENT - 1; i++ )); do
  407. if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
  408. cmd+=( ${words[i,i+1]} )
  409. fi
  410. done
  411. }
  412. # main dispatcher
  413. _pacman_zsh_comp() {
  414. local -a args cmds;
  415. local tmp
  416. args=( ${${${(M)words:#-*}#-}:#-*} )
  417. for tmp in $words; do
  418. cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
  419. done
  420. case $args in #$words[2] in
  421. h*)
  422. if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
  423. _pacman_action_help
  424. else
  425. _message "no more arguments"
  426. fi
  427. ;;
  428. *h*)
  429. _message "no more arguments"
  430. ;;
  431. D*)
  432. _pacman_action_database
  433. ;;
  434. F*)
  435. _pacman_action_files
  436. ;;
  437. Q*g*) # ipkg groups
  438. _arguments -s : \
  439. "$_pacman_opts_common[@]" \
  440. "$_pacman_opts_query_modifiers[@]" \
  441. '*:groups:_pacman_completions_installed_groups'
  442. ;;
  443. Q*o*) # file
  444. _arguments -s : \
  445. "$_pacman_opts_common[@]" \
  446. "$_pacman_opts_query_modifiers[@]" \
  447. '*:package file:_files'
  448. ;;
  449. Q*p*) # file *.pkg.tar*
  450. _arguments -s : \
  451. "$_pacman_opts_common[@]" \
  452. "$_pacman_opts_query_modifiers[@]" \
  453. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  454. ;;
  455. T*)
  456. _pacman_action_deptest
  457. ;;
  458. Q*)
  459. _pacman_action_query
  460. ;;
  461. P*)
  462. _arguments -s : \
  463. "$_pacman_opts_print_modifiers[@]"
  464. ;;
  465. R*)
  466. _pacman_action_remove
  467. ;;
  468. S*c*) # no completion
  469. _arguments -s : \
  470. '(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
  471. "$_pacman_opts_common[@]"
  472. ;;
  473. S*l*) # repos
  474. _arguments -s : \
  475. "$_pacman_opts_common[@]" \
  476. "$_pacman_opts_sync_modifiers[@]" \
  477. '*:package repo:_pacman_completions_repositories' \
  478. ;;
  479. S*g*) # pkg groups
  480. _arguments -s : \
  481. "$_pacman_opts_common[@]" \
  482. "$_pacman_opts_sync_modifiers[@]" \
  483. '*:package group:_pacman_completions_all_groups'
  484. ;;
  485. S*s*)
  486. _arguments -s : \
  487. "$_pacman_opts_common[@]" \
  488. "$_pacman_opts_sync_modifiers[@]" \
  489. '*:search text: '
  490. ;;
  491. S*)
  492. _pacman_action_sync
  493. ;;
  494. T*)
  495. _arguments -s : \
  496. '-T' \
  497. "$_pacman_opts_common[@]" \
  498. ":packages:_pacman_all_packages"
  499. ;;
  500. U*)
  501. _pacman_action_upgrade
  502. ;;
  503. V*)
  504. _pacman_action_version
  505. ;;
  506. Y*)
  507. _arguments -s : \
  508. "$_pacman_opts_yay_modifiers[@]"
  509. ;;
  510. *)
  511. case ${(M)words:#--*} in
  512. *--help*)
  513. if (( ${(w)#cmds} == 1 )); then
  514. _pacman_action_help
  515. else
  516. return 0;
  517. fi
  518. ;;
  519. *--sync*)
  520. _pacman_action_sync
  521. ;;
  522. *--query*)
  523. _pacman_action_query
  524. ;;
  525. *--remove*)
  526. _pacman_action_remove
  527. ;;
  528. *--deptest*)
  529. _pacman_action_deptest
  530. ;;
  531. *--database*)
  532. _pacman_action_database
  533. ;;
  534. *--files*)
  535. _pacman_action_files
  536. ;;
  537. *--version*)
  538. _pacman_action_version
  539. ;;
  540. *--upgrade*)
  541. _pacman_action_upgrade
  542. ;;
  543. *)
  544. _pacman_action_none
  545. ;;
  546. esac
  547. ;;
  548. esac
  549. }
  550. _pacman_comp() {
  551. case "$service" in
  552. yay)
  553. _pacman_zsh_comp "$@"
  554. ;;
  555. *)
  556. _message "Error"
  557. ;;
  558. esac
  559. }
  560. _pacman_comp "$@"