_pod 9.6 KB

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