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