_pod 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. #compdef pod
  2. #autoload
  3. # -----------------------------------------------------------------------------
  4. # FILE: _pod
  5. # DESCRIPTION: Cocoapods (0.27.1) autocomplete plugin for Oh-My-Zsh
  6. # http://cocoapods.org
  7. # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
  8. # GITHUB: https://github.com/mekanics
  9. # TWITTER: @jolyAlexandre
  10. # VERSION: 0.0.3
  11. # LICENSE: MIT
  12. # -----------------------------------------------------------------------------
  13. local -a _1st_arguments
  14. _1st_arguments=(
  15. 'help:Show help for the given command'
  16. 'init:Generate a Podfile for the current directory'
  17. 'install:Install project dependencies'
  18. 'ipc:Inter-process communication'
  19. 'list:List pods'
  20. 'outdated:Show outdated project dependencies'
  21. 'podfile-info:Shows information on installed Pods'
  22. 'push:Push new specifications to a spec-repo'
  23. 'repo:Manage spec-repositories'
  24. 'search:Searches for pods'
  25. 'setup:Setup the CocoaPods environment'
  26. 'spec:Manage pod specs'
  27. 'update:Update outdated project dependencies'
  28. )
  29. local -a _repo_arguments
  30. _repo_arguments=(
  31. 'add:Add a spec repo'
  32. 'lint:Validates all specs in a repo'
  33. 'remove:Remove a spec repo.'
  34. 'update:Update a spec repo'
  35. )
  36. local -a _spec_arguments
  37. _spec_arguments=(
  38. 'cat:Prints a spec file'
  39. 'create:Create spec file stub'
  40. 'edit:Edit a spec file'
  41. 'lint:Validates a spec file'
  42. 'which:Prints the path of the given spec'
  43. )
  44. local -a _ipc_arguments
  45. _ipc_arguments=(
  46. 'list:Lists the specifications know to CocoaPods'
  47. 'podfile:Converts a Podfile to YAML'
  48. 'repl:The repl listens to commands on standard input'
  49. 'spec:Converts a podspec to YAML'
  50. 'update-search-index:Updates the search index'
  51. )
  52. local -a _list_arguments
  53. _list_arguments=(
  54. 'new:Lists pods introduced in the master spec-repo since the last check'
  55. )
  56. local -a _inherited_options
  57. _inherited_options=(
  58. '(--silent)--silent[Show nothing]' \
  59. '(--version)--version[Show the version of CocoaPods]' \
  60. '(--no-color)--no-color[Show output without color]' \
  61. '(--verbose)--verbose[Show more debugging information]' \
  62. '(--help)--help[Show help banner of specified command]'
  63. )
  64. local -a _install_options
  65. _install_options=(
  66. '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn` intact after downloading]' \
  67. '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \
  68. '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]'
  69. )
  70. local -a _update_options
  71. _update_options=(
  72. '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn intact after downloading]' \
  73. '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \
  74. '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]'
  75. )
  76. local -a _outdated_options
  77. _outdated_options=(
  78. '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]'
  79. )
  80. local -a _search_options
  81. _search_options=(
  82. '(--full)--full[Search by name, summary, and description]' \
  83. '(--stats)--stats[Show additional stats (like GitHub watchers and forks)]' \
  84. '(--ios)--ios[Restricts the search to Pods supported on iOS]' \
  85. '(--osx)--osx[Restricts the search to Pods supported on OS X]'
  86. )
  87. local -a _list_options
  88. _list_options=(
  89. '(--update)--update[Run `pod repo update` before listing]'
  90. )
  91. local -a _podfile_info_options
  92. _podfile_info_options=(
  93. '(--all)--all[Show information about all Pods with dependencies that are used in a project]' \
  94. '(--md)--md[Output information in Markdown format]' \
  95. '*:script or directory:_files'
  96. )
  97. local -a _push_options
  98. _push_options=(
  99. '(--allow-warnings)--allow-warnings[Allows pushing even if there are warnings]' \
  100. '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' \
  101. '*:script or directory:_files'
  102. )
  103. local -a _repo_lint_options
  104. _repo_lint_options=(
  105. '(--only-errors)--only-errors[Lint presents only the errors]'
  106. )
  107. local -a _setup_options
  108. _setup_options=(
  109. '(--push)--push[Use this option to enable push access once granted]'
  110. )
  111. local -a _spec_lint_options
  112. _spec_lint_options=(
  113. '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \
  114. '(--only-errors)--only-errors[Lint validates even if warnings are present]' \
  115. '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' \
  116. '*:script or directory:_files'
  117. )
  118. local -a _spec_cat_options
  119. _spec_cat_options=(
  120. '(--show-all)--show-all[Pick from all versions of the given podspec]'
  121. )
  122. local -a _spec_which_options
  123. _spec_which_options=(
  124. '(--show-all)--show-all[Print all versions of the given podspec]'
  125. )
  126. local -a _spec_edit_options
  127. _spec_edit_options=(
  128. '(--show-all)--show-all[Pick which spec to edit from all available versions of the given podspec]'
  129. )
  130. __first_command_list ()
  131. {
  132. local expl
  133. declare -a tasks
  134. tasks=(install ipc list outdated podfile-info push repo search setup spec update)
  135. _wanted tasks expl 'help' compadd $tasks
  136. }
  137. __repo_list() {
  138. _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods/repos 2>/dev/null | sed -e 's/ /\\ /g')
  139. }
  140. __pod-repo() {
  141. local curcontext="$curcontext" state line
  142. typeset -A opt_args
  143. _arguments -C \
  144. ':command:->command' \
  145. '*::options:->options'
  146. case $state in
  147. (command)
  148. _describe -t commands "pod repo" _repo_arguments
  149. return
  150. ;;
  151. (options)
  152. case $line[1] in
  153. (lint)
  154. _arguments \
  155. $_inherited_options \
  156. $_repo_lint_options \
  157. ':feature:__repo_list'
  158. ;;
  159. (update)
  160. _arguments \
  161. $_inherited_options \
  162. ':feature:__repo_list'
  163. ;;
  164. (add)
  165. _arguments \
  166. $_inherited_options
  167. (remove)
  168. _arguments \
  169. $_inherited_options \
  170. ':feature:__repo_list'
  171. ;;
  172. esac
  173. ;;
  174. esac
  175. }
  176. __pod-spec() {
  177. local curcontext="$curcontext" state line
  178. typeset -A opt_args
  179. _arguments -C \
  180. ':command:->command' \
  181. '*::options:->options'
  182. case $state in
  183. (command)
  184. _describe -t commands "pod spec" _spec_arguments
  185. return
  186. ;;
  187. (options)
  188. case $line[1] in
  189. (create)
  190. _arguments \
  191. $_inherited_options
  192. ;;
  193. (lint)
  194. _arguments \
  195. $_inherited_options \
  196. $_spec_lint_options
  197. ;;
  198. (cat)
  199. _arguments \
  200. $_inherited_options \
  201. $_spec_cat_options
  202. ;;
  203. (which)
  204. _arguments \
  205. $_inherited_options \
  206. $_spec_which_options
  207. ;;
  208. (edit)
  209. _arguments \
  210. $_inherited_options \
  211. $_spec_edit_options
  212. ;;
  213. esac
  214. return
  215. ;;
  216. esac
  217. }
  218. __pod-ipc() {
  219. local curcontext="$curcontext" state line
  220. typeset -A opt_args
  221. _arguments -C \
  222. ':command:->command' \
  223. '*::options:->options'
  224. case $state in
  225. (command)
  226. _describe -t commands "pod ipc" _ipc_arguments
  227. return
  228. ;;
  229. (options)
  230. _arguments -C \
  231. $_inherited_options
  232. return
  233. ;;
  234. esac
  235. }
  236. __pod-list() {
  237. local curcontext="$curcontext" state line
  238. typeset -A opt_args
  239. _arguments -C \
  240. $_inherited_options \
  241. $_list_options \
  242. ':command:->command' \
  243. '*::options:->options'
  244. case $state in
  245. (command)
  246. _describe -t commands "pod list" _list_arguments
  247. return
  248. ;;
  249. (options)
  250. _arguments -C \
  251. $_inherited_options \
  252. $_list_options
  253. return
  254. ;;
  255. esac
  256. }
  257. local curcontext="$curcontext" state line
  258. typeset -A opt_args
  259. _arguments -C \
  260. $_inherited_options \
  261. ':command:->command' \
  262. '*::options:->options'
  263. case $state in
  264. (command)
  265. _describe -t commands "pod" _1st_arguments
  266. return
  267. ;;
  268. (options)
  269. case $line[1] in
  270. (help)
  271. _arguments \
  272. $_inherited_options \
  273. ':help:__first_command_list'
  274. ;;
  275. (push)
  276. _arguments \
  277. $_inherited_options \
  278. $_push_options \
  279. ':repo:__repo_list'
  280. ;;
  281. (repo)
  282. __pod-repo
  283. ;;
  284. (spec)
  285. __pod-spec
  286. ;;
  287. (ipc)
  288. __pod-ipc
  289. ;;
  290. (list)
  291. __pod-list
  292. ;;
  293. (install)
  294. _arguments \
  295. $_inherited_options \
  296. $_install_options
  297. ;;
  298. (update)
  299. _arguments \
  300. $_inherited_options \
  301. $_update_options
  302. ;;
  303. (outdated)
  304. _arguments \
  305. $_inherited_options \
  306. $_outdated_options
  307. ;;
  308. (search)
  309. _arguments \
  310. $_inherited_options \
  311. $_search_options
  312. ;;
  313. (podfile-info)
  314. _arguments \
  315. $_inherited_options \
  316. $_podfile_info_options
  317. ;;
  318. (setup)
  319. _arguments \
  320. $_inherited_options \
  321. $_setup_options
  322. ;;
  323. esac
  324. ;;
  325. esac