zsh 19 KB

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