_pod 9.4 KB

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