zsh-completion 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. #compdef pacman pacman.static=pacman pacman-key makepkg
  2. typeset -A opt_args
  3. setopt extendedglob
  4. # options for passing to _arguments: main pacman commands
  5. _pacman_opts_commands=(
  6. {-D,--database}'[Modify database]'
  7. {-Q,--query}'[Query the package database]'
  8. {-R,--remove}'[Remove a package from the system]'
  9. {-S,--sync}'[Synchronize packages]'
  10. {-T,--deptest}'[Check if dependencies are installed]'
  11. {-U,--upgrade}'[Upgrade a package]'
  12. {-V,--version}'[Display version and exit]'
  13. '(-h --help)'{-h,--help}'[Display usage]'
  14. )
  15. # options for passing to _arguments: options common to all commands
  16. _pacman_opts_common=(
  17. {-b,--dbpath}'[Alternate database location]:database_location:_files -/'
  18. '--color[colorize the output]:color options:(always never auto)'
  19. {-h,--help}'[Display syntax for the given operation]'
  20. {-r,--root}'[Set alternate installation root]:installation root:_files -/'
  21. {-v,--verbose}'[Be more verbose]'
  22. '--cachedir[Alternate package cache location]:cache_location:_files -/'
  23. '--config[An alternate configuration file]:config file:_files'
  24. '--logfile[An alternate log file]:config file:_files'
  25. '--noconfirm[Do not ask for confirmation]'
  26. '--noprogressbar[Do not show a progress bar when downloading files]'
  27. '--noscriptlet[Do not execute the install scriptlet if one exists]'
  28. '--print[Only print the targets instead of performing the operation]'
  29. )
  30. # options for passing to _arguments: options for --upgrade commands
  31. _pacman_opts_pkgfile=(
  32. '*-d[Skip dependency checks]'
  33. '*--nodeps[Skip dependency checks]'
  34. '--dbonly[Only remove database entry, do not remove files]'
  35. '--force[Overwrite conflicting files]'
  36. '--needed[Do not reinstall up to date packages]'
  37. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  38. )
  39. # options for passing to _arguments: subactions for --query command
  40. _pacman_opts_query_actions=(
  41. '(-Q --query)'{-Q,--query}
  42. {-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
  43. {-o,--owns}'[Query the package that owns a file]:file:_files'
  44. {-p,--file}'[Package file to query]:*:package file:->query_file'
  45. {-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
  46. )
  47. # options for passing to _arguments: options for --query and subcommands
  48. _pacman_opts_query_modifiers=(
  49. {-c,--changelog}'[List package changelog]'
  50. {-d,--deps}'[List packages installed as dependencies]'
  51. {-e,--explicit}'[List packages explicitly installed]'
  52. {\*-i,\*--info}'[View package information]'
  53. {\*-k,\*--check}'[Check package files]'
  54. {-l,--list}'[List package contents]'
  55. {-m,--foreign}'[List installed packages not found in sync db(s)]'
  56. {-n,--native}'[List installed packages found in sync db(s)]'
  57. {-t,--unrequired}'[List packages not required by any package]'
  58. {-u,--upgrades}'[List packages that can be upgraded]'
  59. )
  60. # options for passing to _arguments: options for --remove command
  61. _pacman_opts_remove=(
  62. {-c,--cascade}'[Remove all dependent packages]'
  63. {*-d,*--nodeps}'[Skip dependency checks]'
  64. {-n,--nosave}'[Remove protected configuration files]'
  65. {\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
  66. '--dbonly[Only remove database entry, do not remove files]'
  67. '*:installed package:_pacman_completions_installed_packages'
  68. )
  69. _pacman_opts_database=(
  70. '--asdeps[mark packages as non-explicitly installed]'
  71. '--asexplicit[mark packages as explicitly installed]'
  72. '*:installed package:_pacman_completions_installed_packages'
  73. )
  74. # options for passing to _arguments: options for --sync command
  75. _pacman_opts_sync_actions=(
  76. '(-S --sync)'{-S,--sync}
  77. {\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
  78. {-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
  79. {-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
  80. '--dbonly[Only remove database entry, do not remove files]'
  81. '--needed[Do not reinstall up to date packages]'
  82. '--recursive[Reinstall all dependencies of target packages]'
  83. )
  84. # options for passing to _arguments: options for --sync command
  85. _pacman_opts_sync_modifiers=(
  86. {\*-d,\*--nodeps}'[Skip dependency checks]'
  87. {\*-i,\*--info}'[View package information]'
  88. {-l,--list}'[List all packages in a repository]'
  89. {-p,--print}'[Print download URIs for each package to be installed]'
  90. {\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
  91. {-w,--downloadonly}'[Download packages only]'
  92. {\*-y,\*--refresh}'[Download fresh package databases]'
  93. '*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
  94. '*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
  95. '--asdeps[Install packages as non-explicitly installed]'
  96. '--asexplicit[Install packages as explicitly installed]'
  97. '--force[Overwrite conflicting files]'
  98. )
  99. # handles --help subcommand
  100. _pacman_action_help() {
  101. _arguments -s : \
  102. "$_pacman_opts_commands[@]"
  103. }
  104. # handles cases where no subcommand has yet been given
  105. _pacman_action_none() {
  106. _arguments -s : \
  107. "$_pacman_opts_commands[@]"
  108. }
  109. # handles --query subcommand
  110. _pacman_action_query() {
  111. local context state line
  112. typeset -A opt_args
  113. case $state in
  114. query_file)
  115. _arguments -s : \
  116. "$_pacman_opts_common[@]" \
  117. "$_pacman_opts_query_modifiers[@]" \
  118. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  119. ;;
  120. query_group)
  121. _arguments -s : \
  122. "$_pacman_opts_common[@]" \
  123. "$_pacman_opts_query_modifiers[@]" \
  124. '*:groups:_pacman_completions_installed_groups'
  125. ;;
  126. query_owner)
  127. _arguments -s : \
  128. "$_pacman_opts_common[@]" \
  129. "$_pacman_opts_query_modifiers[@]" \
  130. '*:file:_files'
  131. ;;
  132. query_search)
  133. _arguments -s : \
  134. "$_pacman_opts_common[@]" \
  135. "$_pacman_opts_query_modifiers[@]" \
  136. '*:search text: '
  137. ;;
  138. *)
  139. _arguments -s : \
  140. "$_pacman_opts_common[@]" \
  141. "$_pacman_opts_query_actions[@]" \
  142. "$_pacman_opts_query_modifiers[@]" \
  143. '*:package:_pacman_completions_installed_packages'
  144. ;;
  145. esac
  146. }
  147. # handles --remove subcommand
  148. _pacman_action_remove() {
  149. _arguments -s : \
  150. '(--remove -R)'{-R,--remove} \
  151. "$_pacman_opts_common[@]" \
  152. "$_pacman_opts_remove[@]"
  153. }
  154. # handles --database subcommand
  155. _pacman_action_database() {
  156. _arguments -s : \
  157. '(--database -D)'{-D,--database} \
  158. "$_pacman_opts_common[@]" \
  159. "$_pacman_opts_database[@]"
  160. }
  161. _pacman_action_deptest () {
  162. _arguments -s : \
  163. '(--deptest)-T' \
  164. "$_pacman_opts_common[@]" \
  165. ":packages:_pacman_all_packages"
  166. }
  167. # handles --sync subcommand
  168. _pacman_action_sync() {
  169. local context state line
  170. typeset -A opt_args
  171. if (( $+words[(r)--clean] )); then
  172. state=sync_clean
  173. elif (( $+words[(r)--groups] )); then
  174. state=sync_group
  175. elif (( $+words[(r)--search] )); then
  176. state=sync_search
  177. fi
  178. case $state in
  179. sync_clean)
  180. _arguments -s : \
  181. {\*-c,\*--clean}'[Remove old packages from cache]' \
  182. "$_pacman_opts_common[@]" \
  183. "$_pacman_opts_sync_modifiers[@]"
  184. ;;
  185. sync_group)
  186. _arguments -s : \
  187. "$_pacman_opts_common[@]" \
  188. "$_pacman_opts_sync_modifiers[@]" \
  189. '(-g --group)'{-g,--groups} \
  190. '*:package group:_pacman_completions_all_groups'
  191. ;;
  192. sync_search)
  193. _arguments -s : \
  194. "$_pacman_opts_common[@]" \
  195. "$_pacman_opts_sync_modifiers[@]" \
  196. '*:search text: '
  197. ;;
  198. *)
  199. _arguments -s : \
  200. "$_pacman_opts_common[@]" \
  201. "$_pacman_opts_sync_actions[@]" \
  202. "$_pacman_opts_sync_modifiers[@]" \
  203. '*:package:_pacman_completions_all_packages'
  204. ;;
  205. esac
  206. }
  207. # handles --upgrade subcommand
  208. _pacman_action_upgrade() {
  209. _arguments -s : \
  210. '(-U --upgrade)'{-U,--upgrade} \
  211. "$_pacman_opts_common[@]" \
  212. "$_pacman_opts_pkgfile[@]"
  213. }
  214. # handles --version subcommand
  215. _pacman_action_version() {
  216. # no further arguments
  217. return 0
  218. }
  219. # provides completions for package groups
  220. _pacman_completions_all_groups() {
  221. local -a cmd groups
  222. _pacman_get_command
  223. groups=( $(_call_program groups $cmd[@] -Sg) )
  224. typeset -U groups
  225. compadd "$@" -a groups
  226. }
  227. # provides completions for packages available from repositories
  228. # these can be specified as either 'package' or 'repository/package'
  229. _pacman_completions_all_packages() {
  230. local -a cmd packages repositories packages_long
  231. _pacman_get_command
  232. if compset -P1 '*/*'; then
  233. packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) )
  234. typeset -U packages
  235. _wanted repo_packages expl "repository/package" compadd ${(@)packages}
  236. else
  237. packages=( $(_call_program packages $cmd[@] -Sql) )
  238. typeset -U packages
  239. _wanted packages expl "packages" compadd - "${(@)packages}"
  240. repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
  241. typeset -U repositories
  242. _wanted repo_packages expl "repository/package" compadd -S "/" $repositories
  243. fi
  244. }
  245. # provides completions for package groups
  246. _pacman_completions_installed_groups() {
  247. local -a cmd groups
  248. _pacman_get_command
  249. groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
  250. typeset -U groups
  251. compadd "$@" -a groups
  252. }
  253. # provides completions for installed packages
  254. _pacman_completions_installed_packages() {
  255. local -a cmd packages packages_long
  256. packages_long=(@localstatedir@/lib/pacman/local/*(/))
  257. packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
  258. compadd "$@" -a packages
  259. }
  260. _pacman_all_packages() {
  261. _alternative : \
  262. 'localpkgs:local packages:_pacman_completions_installed_packages' \
  263. 'repopkgs:repository packages:_pacman_completions_all_packages'
  264. }
  265. # provides completions for repository names
  266. _pacman_completions_repositories() {
  267. local -a cmd repositories
  268. repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
  269. # Uniq the array
  270. typeset -U repositories
  271. compadd "$@" -a repositories
  272. }
  273. # builds command for invoking pacman in a _call_program command - extracts
  274. # relevant options already specified (config file, etc)
  275. # $cmd must be declared by calling function
  276. _pacman_get_command() {
  277. # this is mostly nicked from _perforce
  278. cmd=( "pacman" "2>/dev/null")
  279. integer i
  280. for (( i = 2; i < CURRENT - 1; i++ )); do
  281. if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
  282. cmd+=( ${words[i,i+1]} )
  283. fi
  284. done
  285. }
  286. # main dispatcher
  287. _pacman_zsh_comp() {
  288. local -a args cmds;
  289. local tmp
  290. args=( ${${${(M)words:#-*}#-}:#-*} )
  291. for tmp in $words; do
  292. cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
  293. done
  294. case $args in #$words[2] in
  295. h*)
  296. if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
  297. _pacman_action_help
  298. else
  299. _message "no more arguments"
  300. fi
  301. ;;
  302. *h*)
  303. _message "no more arguments"
  304. ;;
  305. D*)
  306. _pacman_action_database
  307. ;;
  308. Q*g*) # ipkg groups
  309. _arguments -s : \
  310. "$_pacman_opts_common[@]" \
  311. "$_pacman_opts_query_modifiers[@]" \
  312. '*:groups:_pacman_completions_installed_groups'
  313. ;;
  314. Q*o*) # file
  315. _arguments -s : \
  316. "$_pacman_opts_common[@]" \
  317. "$_pacman_opts_query_modifiers[@]" \
  318. '*:package file:_files'
  319. ;;
  320. Q*p*) # file *.pkg.tar*
  321. _arguments -s : \
  322. "$_pacman_opts_common[@]" \
  323. "$_pacman_opts_query_modifiers[@]" \
  324. '*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
  325. ;;
  326. T*)
  327. _pacman_action_deptest
  328. ;;
  329. Q*)
  330. _pacman_action_query
  331. ;;
  332. R*)
  333. _pacman_action_remove
  334. ;;
  335. S*c*) # no completion
  336. _arguments -s : \
  337. '(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
  338. "$_pacman_opts_common[@]"
  339. ;;
  340. S*l*) # repos
  341. _arguments -s : \
  342. "$_pacman_opts_common[@]" \
  343. "$_pacman_opts_sync_modifiers[@]" \
  344. '*:package repo:_pacman_completions_repositories' \
  345. ;;
  346. S*g*) # pkg groups
  347. _arguments -s : \
  348. "$_pacman_opts_common[@]" \
  349. "$_pacman_opts_sync_modifiers[@]" \
  350. '*:package group:_pacman_completions_all_groups'
  351. ;;
  352. S*s*)
  353. _arguments -s : \
  354. "$_pacman_opts_common[@]" \
  355. "$_pacman_opts_sync_modifiers[@]" \
  356. '*:search text: '
  357. ;;
  358. S*)
  359. _pacman_action_sync
  360. ;;
  361. T*)
  362. _arguments -s : \
  363. '-T' \
  364. "$_pacman_opts_common[@]" \
  365. ":packages:_pacman_all_packages"
  366. ;;
  367. U*)
  368. _pacman_action_upgrade
  369. ;;
  370. V*)
  371. _pacman_action_version
  372. ;;
  373. *)
  374. case ${(M)words:#--*} in
  375. *--help*)
  376. if (( ${(w)#cmds} == 1 )); then
  377. _pacman_action_help
  378. else
  379. return 0;
  380. fi
  381. ;;
  382. *--sync*)
  383. _pacman_action_sync
  384. ;;
  385. *--query*)
  386. _pacman_action_query
  387. ;;
  388. *--remove*)
  389. _pacman_action_remove
  390. ;;
  391. *--deptest*)
  392. _pacman_action_deptest
  393. ;;
  394. *--database*)
  395. _pacman_action_database
  396. ;;
  397. *--version*)
  398. _pacman_action_version
  399. ;;
  400. *--upgrade*)
  401. _pacman_action_upgrade
  402. ;;
  403. *)
  404. _pacman_action_none
  405. ;;
  406. esac
  407. ;;
  408. esac
  409. }
  410. _key_shortopts=(
  411. '-h[show help]'
  412. '-a[Add the specified keys (empty for stdin)]: :_files'
  413. '-d[Remove the Specified keyids]:*: :_keys'
  414. '-e[Export the specified or all keyids]:*: :_keys'
  415. '-f[List fingreprint for specidied or all keyids]:*: :_keys'
  416. '-l[List the specified or all keys]:*: :_keys'
  417. '-r[Fetch the specified keyids]:*: :_keys'
  418. '-u[Update the trustdb of pacman]'
  419. '-v[Verify the file specified by the signature]: :_files -g "*.sig"'
  420. '-V[Show program version]'
  421. )
  422. _key_longopts=(
  423. '--help[show help]'
  424. '--add[Add the specified keys (empty for stdin)]: :_files'
  425. '--delete[Remove the Specified keyids]:*: :_keys'
  426. '--export[Export the specified or all keyids]:*: :_keys'
  427. '--finger[List fingreprint for specidied or all keyids]:*: :_keys'
  428. '--list-keys[List the specified or all keys]:*: :_keys'
  429. '--recv-keys[Fetch the specified keyids]:*: :_keys'
  430. '--updatedb[Update the trustdb of pacman]'
  431. '--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
  432. '--version[Show program version]'
  433. '--edit-key[Present a menu for key management task on keyids]:*: :_keys'
  434. '--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
  435. '--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
  436. '--init[Ensure the keyring is properly initialized]'
  437. '--list-sigs[List keys and their signatures]:*: :_keys'
  438. '--lsign-key[Locally sign the specified keyid]:*: :_keys'
  439. '--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
  440. '--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
  441. )
  442. _pacman_key_options=(
  443. '--config[Use an alternate config file (instead of @sysconfdir@/pacman.conf)]: :_files'
  444. '--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
  445. '--keyserver[Specify a keyserver to use if necessary]'
  446. )
  447. _pacman_key() {
  448. case $words[CURRENT] in
  449. --*)
  450. _arguments -s : \
  451. "$_pacman_key_options[@]" \
  452. "$_key_longopts[@]"
  453. ;;
  454. -*)
  455. _arguments -s : \
  456. "$_pacman_key_options[@]" \
  457. "$_key_shortopts[@]" \
  458. "$_key_longopts[@]"
  459. ;;
  460. *)
  461. i=$#;
  462. while [[ $words[$i] != -* ]] && [[ $words[$i] != "pacman-key" ]];do
  463. i=$(($i-1))
  464. done
  465. case $i in
  466. --*)
  467. _arguments -s : \
  468. "$_pacman_key_options[@]" \
  469. "$_key_longopts[@]"
  470. ;;
  471. -*)
  472. _arguments -s : \
  473. "$_pacman_key_options[@]" \
  474. "$_key_shortopts[@]" \
  475. "$_key_longopts[@]"
  476. ;;
  477. *)
  478. return 1
  479. ;;
  480. esac
  481. ;;
  482. esac
  483. }
  484. _keys() {
  485. local keylist keys
  486. keylist=$(pacman-key --list-keys 2>/dev/null | awk '
  487. $1 == "pub" {
  488. # key id
  489. split($2, a, "/"); print a[2]
  490. }
  491. $1 == "uid" {
  492. # email
  493. if (match($NF, /<[^>]+>/))
  494. print substr($NF, RSTART + 1, RLENGTH - 2)
  495. #this adds support for names as well if that is ever added
  496. }
  497. $1 == "uid" {
  498. for (i=2;i<NF;i++) {printf "%s%s",sep, $i;sep=" "}; printf "\n"
  499. }' |sed -e 's/(.*)//g' -e 's/^\ //g' -e 's/\ *$//g' |uniq
  500. )
  501. keys=(${(s:/:)${keylist//$'\n'/\/}})
  502. _describe -t modules 'keys in keyring' keys && return 0
  503. }
  504. _makepkg_shortopts=(
  505. '-s[Install missing dependencies with pacman]'
  506. '-i[Install package after successful build]'
  507. '-A[Ignore incomplete arch field in PKGBUILD]'
  508. '-c[Clean up work files after build]'
  509. '-d[Skip all dependency checks]'
  510. '-e[Do not extract source files (use existing src/ dir)]'
  511. '-f[Overwrite existing package]'
  512. '-g[Generate integrity checks for source files]'
  513. '-h[Show help message and exit]'
  514. '-L[Log package build process]'
  515. '-m[Disable colorized output messages]'
  516. '-o[Download and extract files only]'
  517. '-p[Use an alternate build script (instead of 'PKGBUILD')]: :_files'
  518. '-r[Remove installed dependencies after a successful build]'
  519. '-R[Repackage contents of the package without rebuilding]'
  520. '-S[Generate a source-only tarball without downloading sources]'
  521. )
  522. _makepkg_action_none(){
  523. _arguments \
  524. "$_makepkg_shortopts[@]" \
  525. "$_makepkg_longopts[@]"
  526. }
  527. _makepkg_longopts=(
  528. '--ignorearch[Ignore incomplete arch field in PKGBUILD]'
  529. '--clean[Clean up work files after build]'
  530. '--nodeps[Skip all dependency checks]'
  531. '--noextract[Do not extract source files (use existing src/ dir)]'
  532. '--force[Overwrite existing package]'
  533. '--geninteg[Generate integrity checks for source files]'
  534. '--help[Show help message and exit]'
  535. '--install[Install package after successful build]'
  536. '--log[Log package build process]'
  537. '--nocolor[Disable colorized output messages]'
  538. '--nobuild[Download and extract files only]'
  539. '--rmdeps[Remove installed dependencies after a successful build]'
  540. '--repackage[Repackage contents of the package without rebuilding]'
  541. '--syncdeps[Install missing dependencies with pacman]'
  542. '--source[Generate a source-only tarball without downloading sources]'
  543. '--allsource[Generate a source-only tarball including downloaded source]'
  544. '--asroot[Allow makepkg to run as root user]'
  545. '--check[Run check() function in the PKGBUILD]'
  546. '--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
  547. '--holdver[Prevent automatic version bumping for development PKGBUILDs]'
  548. '--key[Specify key to use for gpg signing instead of the default]: :_keys'
  549. '--nocheck[Do not run the check() function in the PKGBUILD]'
  550. '--noprepare[Do not run the prepare() function in the PKGBUILD]'
  551. '--nosign[Do not create a signature for the package]'
  552. '--pkg[Only build listed packages from a split package]'
  553. '--sign[Sign the resulting package with gpg]'
  554. '--skipchecksums[Do not verify checksums of the source files]'
  555. '--skipinteg[do not perform any verification checks on source files]'
  556. '--skippgpcheck[Do not verify source files with PGP signatures]'
  557. '--noconfirm[do not ask for confirmation when resolving dependencies]'
  558. '--asdeps[Install packages as non-explicitly installed]'
  559. '--noprogressbar[Do not show a progress bar when downloading files]'
  560. '--needed[Do not reinstall up-to-date packages]'
  561. '--verifysource[Only download sources and verify checksums]'
  562. )
  563. _makepkg(){
  564. case $words[CURRENT] in
  565. -*)
  566. _arguments -s -w : \
  567. "$_makepkg_shortopts[@]" \
  568. "$_makepkg_longopts[@]"
  569. ;;
  570. --* )
  571. _arguments -s \
  572. "$_makepkg_longopts[@]"
  573. ;;
  574. - )
  575. _makepkg_action_none
  576. ;;
  577. *)
  578. i=$#
  579. while [[ $words[i] != -* ]] && [[ $words[$i] != "makepkg" ]];do
  580. i=$((i-1));
  581. done
  582. case $words[$i] in
  583. -*)
  584. _arguments -s -w : \
  585. "$_makepkg_shortopts[@]" \
  586. "$_makepkg_longopts[@]"
  587. ;;
  588. --* )
  589. _arguments -s \
  590. "$_makepkg_longopts[@]"
  591. ;;
  592. - )
  593. _makepkg_action_none
  594. ;;
  595. * )
  596. return 1
  597. ;;
  598. esac
  599. ;;
  600. esac
  601. }
  602. _pacman_comp() {
  603. case "$service" in
  604. makepkg)
  605. _makepkg "$@"
  606. ;;
  607. pacman-key)
  608. _pacman_key "$@"
  609. ;;
  610. pacman)
  611. _pacman_zsh_comp "$@"
  612. ;;
  613. yay)
  614. _pacman_zsh_comp "$@"
  615. ;;
  616. *)
  617. _message "Error"
  618. ;;
  619. esac
  620. }
  621. _pacman_comp "$@"