zsh 19 KB

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