zsh 19 KB

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