zsh 19 KB

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