zsh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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,--show}'[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. # -G
  144. _pacman_opts_getpkgbuild_modifiers=(
  145. {-f,--force}'[Force download for existing tar packages]'
  146. )
  147. # -P
  148. _pacman_opts_print_modifiers=(
  149. {-c,--complete}'[Used for completions]'
  150. {-d,--defaultconfig}'[Print default yay configuration]'
  151. {-g,--config}'[Print current yay configuration]'
  152. {-n,--numberupgrades}'[Print number of updates]'
  153. {-s,--stats}'[Display system package statistics]'
  154. {-u,--upgrades}'[Print update list]'
  155. {-w,--news}'[Print arch news]'
  156. )
  157. # options for passing to _arguments: options for --remove command
  158. _pacman_opts_remove=(
  159. {-c,--cascade}'[Remove all dependent packages]'
  160. {-d,--nodeps}'[Skip dependency checks]'
  161. '*--assume-installed[Add virtual package to satisfy dependencies]'
  162. {-n,--nosave}'[Remove protected configuration files]'
  163. {-p,--print}'[Only print the targets instead of performing the operation]'
  164. {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
  165. {-u,--unneeded}'[Remove unneeded packages]'
  166. '--dbonly[Only remove database entry, do not remove files]'
  167. '--print-format[Specify how the targets should be printed]'
  168. '*:installed package:_pacman_completions_installed_packages'
  169. )
  170. _pacman_opts_database=(
  171. '--asdeps[mark packages as non-explicitly installed]'
  172. '--asexplicit[mark packages as explicitly installed]'
  173. '*:installed package:_pacman_completions_installed_packages'
  174. )
  175. _pacman_opts_files=(
  176. {-l,--list}'[List the files owned by the queried package]:package:_pacman_completions_all_packages'
  177. {-o,--owns}'[Query the package that owns]:files:_files'
  178. {-s,--search}'[Search package file names for matching strings]:files:_files'
  179. {-x,--regex}'[Enable searching using regular expressions]:regex:'
  180. {-y,--refresh}'[Download fresh files databases from the server]'
  181. '--machinereadable[Produce machine-readable output]'
  182. {-q,--quiet}'[Show less information for query and search]'
  183. )
  184. # options for passing to _arguments: options for --sync command
  185. _pacman_opts_sync_actions=(
  186. '(-S --sync)'{-S,--sync}
  187. {\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
  188. {-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
  189. {-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
  190. '--dbonly[Only remove database entry, do not remove files]'
  191. '--needed[Do not reinstall up to date packages]'
  192. '--recursive[Reinstall all dependencies of target packages]'
  193. )
  194. # options for passing to _arguments: options for --sync command
  195. _pacman_opts_sync_modifiers=(
  196. {\*-d,\*--nodeps}'[Skip dependency checks]'
  197. '*--assume-installed[Add virtual package to satisfy dependencies]'
  198. {\*-i,\*--info}'[View package information]'
  199. {-l,--list}'[List all packages in a repository]'
  200. {-p,--print}'[Print download URIs for each package to be installed]'
  201. {-q,--quiet}'[Show less information for query and search]'
  202. {\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
  203. {-w,--downloadonly}'[Download packages only]'
  204. {\*-y,\*--refresh}'[Download fresh package databases]'
  205. '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
  206. '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
  207. '--asdeps[Install packages as non-explicitly installed]'
  208. '--asexplicit[Install packages as explicitly installed]'
  209. '--force[Overwrite conflicting files]'
  210. '--print-format[Specify how the targets should be printed]'
  211. )
  212. # handles --help subcommand
  213. _pacman_action_help() {
  214. _arguments -s : \
  215. "$_pacman_opts_commands[@]"
  216. }
  217. # handles cases where no subcommand has yet been given
  218. _pacman_action_none() {
  219. _arguments -s : \
  220. "$_pacman_opts_commands[@]"
  221. }
  222. # handles --query subcommand
  223. _pacman_action_query() {
  224. local context state line
  225. typeset -A opt_args
  226. case $state in
  227. query_file)
  228. _arguments -s : \
  229. "$_pacman_opts_common[@]" \
  230. "$_pacman_opts_query_modifiers[@]" \
  231. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  232. ;;
  233. query_group)
  234. _arguments -s : \
  235. "$_pacman_opts_common[@]" \
  236. "$_pacman_opts_query_modifiers[@]" \
  237. '*:groups:_pacman_completions_installed_groups'
  238. ;;
  239. query_owner)
  240. _arguments -s : \
  241. "$_pacman_opts_common[@]" \
  242. "$_pacman_opts_query_modifiers[@]" \
  243. '*:file:_files'
  244. ;;
  245. query_search)
  246. _arguments -s : \
  247. "$_pacman_opts_common[@]" \
  248. "$_pacman_opts_query_modifiers[@]" \
  249. '*:search text: '
  250. ;;
  251. *)
  252. _arguments -s : \
  253. "$_pacman_opts_common[@]" \
  254. "$_pacman_opts_query_actions[@]" \
  255. "$_pacman_opts_query_modifiers[@]" \
  256. '*:package:_pacman_completions_installed_packages'
  257. ;;
  258. esac
  259. }
  260. # handles --remove subcommand
  261. _pacman_action_remove() {
  262. _arguments -s : \
  263. '(--remove -R)'{-R,--remove} \
  264. "$_pacman_opts_common[@]" \
  265. "$_pacman_opts_remove[@]"
  266. }
  267. # handles --database subcommand
  268. _pacman_action_database() {
  269. _arguments -s : \
  270. '(--database -D)'{-D,--database} \
  271. "$_pacman_opts_common[@]" \
  272. "$_pacman_opts_database[@]"
  273. }
  274. # handles --files subcommand
  275. _pacman_action_files() {
  276. _arguments -s : \
  277. '(--files -F)'{-F,--files} \
  278. "$_pacman_opts_common[@]" \
  279. "$_pacman_opts_files[@]"
  280. }
  281. _pacman_action_deptest () {
  282. _arguments -s : \
  283. '(--deptest)-T' \
  284. "$_pacman_opts_common[@]" \
  285. ":packages:_pacman_all_packages"
  286. }
  287. # handles --sync subcommand
  288. _pacman_action_sync() {
  289. local context state line
  290. typeset -A opt_args
  291. if (( $+words[(r)--clean] )); then
  292. state=sync_clean
  293. elif (( $+words[(r)--groups] )); then
  294. state=sync_group
  295. elif (( $+words[(r)--search] )); then
  296. state=sync_search
  297. fi
  298. case $state in
  299. sync_clean)
  300. _arguments -s : \
  301. {\*-c,\*--clean}'[Remove old packages from cache]' \
  302. "$_pacman_opts_common[@]" \
  303. "$_pacman_opts_sync_modifiers[@]"
  304. ;;
  305. sync_group)
  306. _arguments -s : \
  307. "$_pacman_opts_common[@]" \
  308. "$_pacman_opts_sync_modifiers[@]" \
  309. '(-g --group)'{-g,--groups} \
  310. '*:package group:_pacman_completions_all_groups'
  311. ;;
  312. sync_search)
  313. _arguments -s : \
  314. "$_pacman_opts_common[@]" \
  315. "$_pacman_opts_sync_modifiers[@]" \
  316. '*:search text: '
  317. ;;
  318. *)
  319. _arguments -s : \
  320. "$_pacman_opts_common[@]" \
  321. "$_pacman_opts_sync_actions[@]" \
  322. "$_pacman_opts_sync_modifiers[@]" \
  323. '*:package:_pacman_completions_all_packages'
  324. ;;
  325. esac
  326. }
  327. # handles --upgrade subcommand
  328. _pacman_action_upgrade() {
  329. _arguments -s : \
  330. '(-U --upgrade)'{-U,--upgrade} \
  331. "$_pacman_opts_common[@]" \
  332. "$_pacman_opts_pkgfile[@]"
  333. }
  334. # handles --version subcommand
  335. _pacman_action_version() {
  336. # no further arguments
  337. return 0
  338. }
  339. # provides completions for package groups
  340. _pacman_completions_all_groups() {
  341. local -a cmd groups
  342. _pacman_get_command
  343. groups=( $(_call_program groups $cmd[@] -Sg) )
  344. typeset -U groups
  345. if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then
  346. _sequence compadd -S ',' "$@" -a groups
  347. else
  348. compadd "$@" -a groups
  349. fi
  350. }
  351. # provides completions for packages available from repositories
  352. # these can be specified as either 'package' or 'repository/package'
  353. _pacman_completions_all_packages() {
  354. local -a seq sep cmd packages repositories packages_long
  355. if [[ ${words[CURRENT-1]} == '--ignore' ]]; then
  356. seq='_sequence'
  357. sep=(-S ',')
  358. else
  359. seq=
  360. sep=()
  361. fi
  362. if compset -P1 '*/*'; then
  363. packages=( $(_call_program packages yay -Pc ${words[CURRENT]%/*}) )
  364. typeset -U packages
  365. ${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
  366. else
  367. packages=( $(_call_program packages yay -Pc ) )
  368. typeset -U packages
  369. ${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
  370. repositories=($(pacman-conf --repo-list))
  371. typeset -U repositories
  372. _wanted repo_packages expl "repository/package" compadd -S "/" $repositories
  373. fi
  374. }
  375. # provides completions for package groups
  376. _pacman_completions_installed_groups() {
  377. local -a cmd groups
  378. _pacman_get_command
  379. groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
  380. typeset -U groups
  381. compadd "$@" -a groups
  382. }
  383. # provides completions for installed packages
  384. _pacman_completions_installed_packages() {
  385. local -a cmd packages packages_long
  386. packages_long=(/var/lib/pacman/local/*(/))
  387. packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
  388. compadd "$@" -a packages
  389. }
  390. _pacman_all_packages() {
  391. _alternative : \
  392. 'localpkgs:local packages:_pacman_completions_installed_packages' \
  393. 'repopkgs:repository packages:_pacman_completions_all_packages'
  394. }
  395. # provides completions for repository names
  396. _pacman_completions_repositories() {
  397. local -a cmd repositories
  398. repositories=($(pacman-conf --repo-list))
  399. # Uniq the array
  400. typeset -U repositories
  401. compadd "$@" -a repositories
  402. }
  403. # builds command for invoking pacman in a _call_program command - extracts
  404. # relevant options already specified (config file, etc)
  405. # $cmd must be declared by calling function
  406. _pacman_get_command() {
  407. # this is mostly nicked from _perforce
  408. cmd=( "pacman" "2>/dev/null")
  409. integer i
  410. for (( i = 2; i < CURRENT - 1; i++ )); do
  411. if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
  412. cmd+=( ${words[i,i+1]} )
  413. fi
  414. done
  415. }
  416. # main dispatcher
  417. _pacman_zsh_comp() {
  418. local -a args cmds;
  419. local tmp
  420. args=( ${${${(M)words:#-*}#-}:#-*} )
  421. for tmp in $words; do
  422. cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
  423. done
  424. case $args in #$words[2] in
  425. h*)
  426. if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
  427. _pacman_action_help
  428. else
  429. _message "no more arguments"
  430. fi
  431. ;;
  432. *h*)
  433. _message "no more arguments"
  434. ;;
  435. D*)
  436. _pacman_action_database
  437. ;;
  438. F*)
  439. _pacman_action_files
  440. ;;
  441. Q*g*) # ipkg groups
  442. _arguments -s : \
  443. "$_pacman_opts_common[@]" \
  444. "$_pacman_opts_query_modifiers[@]" \
  445. '*:groups:_pacman_completions_installed_groups'
  446. ;;
  447. Q*o*) # file
  448. _arguments -s : \
  449. "$_pacman_opts_common[@]" \
  450. "$_pacman_opts_query_modifiers[@]" \
  451. '*:package file:_files'
  452. ;;
  453. Q*p*) # file *.pkg.tar*
  454. _arguments -s : \
  455. "$_pacman_opts_common[@]" \
  456. "$_pacman_opts_query_modifiers[@]" \
  457. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  458. ;;
  459. T*)
  460. _pacman_action_deptest
  461. ;;
  462. Q*)
  463. _pacman_action_query
  464. ;;
  465. P*)
  466. _arguments -s : \
  467. "$_pacman_opts_print_modifiers[@]"
  468. ;;
  469. R*)
  470. _pacman_action_remove
  471. ;;
  472. S*c*) # no completion
  473. _arguments -s : \
  474. '(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
  475. "$_pacman_opts_common[@]"
  476. ;;
  477. S*l*) # repos
  478. _arguments -s : \
  479. "$_pacman_opts_common[@]" \
  480. "$_pacman_opts_sync_modifiers[@]" \
  481. '*:package repo:_pacman_completions_repositories' \
  482. ;;
  483. S*g*) # pkg groups
  484. _arguments -s : \
  485. "$_pacman_opts_common[@]" \
  486. "$_pacman_opts_sync_modifiers[@]" \
  487. '*:package group:_pacman_completions_all_groups'
  488. ;;
  489. S*s*)
  490. _arguments -s : \
  491. "$_pacman_opts_common[@]" \
  492. "$_pacman_opts_sync_modifiers[@]" \
  493. '*:search text: '
  494. ;;
  495. S*)
  496. _pacman_action_sync
  497. ;;
  498. T*)
  499. _arguments -s : \
  500. '-T' \
  501. "$_pacman_opts_common[@]" \
  502. ":packages:_pacman_all_packages"
  503. ;;
  504. U*)
  505. _pacman_action_upgrade
  506. ;;
  507. V*)
  508. _pacman_action_version
  509. ;;
  510. Y*)
  511. _arguments -s : \
  512. "$_pacman_opts_yay_modifiers[@]"
  513. ;;
  514. G*)
  515. _arguments -s : \
  516. "$_pacman_opts_getpkgbuild_modifiers[@]"
  517. ;;
  518. *)
  519. case ${(M)words:#--*} in
  520. *--help*)
  521. if (( ${(w)#cmds} == 1 )); then
  522. _pacman_action_help
  523. else
  524. return 0;
  525. fi
  526. ;;
  527. *--sync*)
  528. _pacman_action_sync
  529. ;;
  530. *--query*)
  531. _pacman_action_query
  532. ;;
  533. *--remove*)
  534. _pacman_action_remove
  535. ;;
  536. *--deptest*)
  537. _pacman_action_deptest
  538. ;;
  539. *--database*)
  540. _pacman_action_database
  541. ;;
  542. *--files*)
  543. _pacman_action_files
  544. ;;
  545. *--version*)
  546. _pacman_action_version
  547. ;;
  548. *--upgrade*)
  549. _pacman_action_upgrade
  550. ;;
  551. *)
  552. _pacman_action_none
  553. ;;
  554. esac
  555. ;;
  556. esac
  557. }
  558. _pacman_comp() {
  559. case "$service" in
  560. yay)
  561. _pacman_zsh_comp "$@"
  562. ;;
  563. *)
  564. _message "Error"
  565. ;;
  566. esac
  567. }
  568. _pacman_comp "$@"