_pod 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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. '*:script or directory:_files'
  94. )
  95. local -a _push_options
  96. _push_options=(
  97. '(--allow-warnings)--allow-warnings[Allows pushing even if there are warnings]' \
  98. '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' \
  99. '*:script or directory:_files'
  100. )
  101. local -a _repo_lint_options
  102. _repo_lint_options=(
  103. '(--only-errors)--only-errors[Lint presents only the errors]'
  104. )
  105. local -a _setup_options
  106. _setup_options=(
  107. '(--push)--push[Use this option to enable push access once granted]'
  108. )
  109. local -a _spec_lint_options
  110. _spec_lint_options=(
  111. '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \
  112. '(--only-errors)--only-errors[Lint validates even if warnings are present]' \
  113. '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' \
  114. '*:script or directory:_files'
  115. )
  116. local -a _spec_cat_options
  117. _spec_cat_options=(
  118. '(--show-all)--show-all[Pick from all versions of the given podspec]'
  119. )
  120. local -a _spec_which_options
  121. _spec_which_options=(
  122. '(--show-all)--show-all[Print all versions of the given podspec]'
  123. )
  124. local -a _spec_edit_options
  125. _spec_edit_options=(
  126. '(--show-all)--show-all[Pick which spec to edit from all available versions of the given podspec]'
  127. )
  128. __first_command_list ()
  129. {
  130. local expl
  131. declare -a tasks
  132. tasks=(install ipc list outdated podfile-info push repo search setup spec update)
  133. _wanted tasks expl 'help' compadd $tasks
  134. }
  135. __repo_list() {
  136. _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g')
  137. }
  138. __pod-repo() {
  139. local curcontext="$curcontext" state line
  140. typeset -A opt_args
  141. _arguments -C \
  142. ':command:->command' \
  143. '*::options:->options'
  144. case $state in
  145. (command)
  146. _describe -t commands "pod repo" _repo_arguments
  147. return
  148. ;;
  149. (options)
  150. case $line[1] in
  151. (lint)
  152. _arguments \
  153. $_inherited_options \
  154. $_repo_lint_options \
  155. ':feature:__repo_list'
  156. ;;
  157. (update)
  158. _arguments \
  159. $_inherited_options \
  160. ':feature:__repo_list'
  161. ;;
  162. (add)
  163. _arguments \
  164. $_inherited_options
  165. esac
  166. ;;
  167. esac
  168. }
  169. __pod-spec() {
  170. local curcontext="$curcontext" state line
  171. typeset -A opt_args
  172. _arguments -C \
  173. ':command:->command' \
  174. '*::options:->options'
  175. case $state in
  176. (command)
  177. _describe -t commands "pod spec" _spec_arguments
  178. return
  179. ;;
  180. (options)
  181. case $line[1] in
  182. (create)
  183. _arguments \
  184. $_inherited_options
  185. ;;
  186. (lint)
  187. _arguments \
  188. $_inherited_options \
  189. $_spec_lint_options
  190. ;;
  191. (cat)
  192. _arguments \
  193. $_inherited_options \
  194. $_spec_cat_options
  195. ;;
  196. (which)
  197. _arguments \
  198. $_inherited_options \
  199. $_spec_which_options
  200. ;;
  201. (edit)
  202. _arguments \
  203. $_inherited_options \
  204. $_spec_edit_options
  205. ;;
  206. esac
  207. return
  208. ;;
  209. esac
  210. }
  211. __pod-ipc() {
  212. local curcontext="$curcontext" state line
  213. typeset -A opt_args
  214. _arguments -C \
  215. ':command:->command' \
  216. '*::options:->options'
  217. case $state in
  218. (command)
  219. _describe -t commands "pod ipc" _ipc_arguments
  220. return
  221. ;;
  222. (options)
  223. _arguments -C \
  224. $_inherited_options
  225. return
  226. ;;
  227. esac
  228. }
  229. __pod-list() {
  230. local curcontext="$curcontext" state line
  231. typeset -A opt_args
  232. _arguments -C \
  233. $_inherited_options \
  234. $_list_options \
  235. ':command:->command' \
  236. '*::options:->options'
  237. case $state in
  238. (command)
  239. _describe -t commands "pod list" _list_arguments
  240. return
  241. ;;
  242. (options)
  243. _arguments -C \
  244. $_inherited_options \
  245. $_list_options
  246. return
  247. ;;
  248. esac
  249. }
  250. local curcontext="$curcontext" state line
  251. typeset -A opt_args
  252. _arguments -C \
  253. $_inherited_options \
  254. ':command:->command' \
  255. '*::options:->options'
  256. case $state in
  257. (command)
  258. _describe -t commands "pod" _1st_arguments
  259. return
  260. ;;
  261. (options)
  262. case $line[1] in
  263. (help)
  264. _arguments \
  265. $_inherited_options \
  266. ':help:__first_command_list'
  267. ;;
  268. (push)
  269. _arguments \
  270. $_inherited_options \
  271. $_push_options \
  272. ':repo:__repo_list'
  273. ;;
  274. (repo)
  275. __pod-repo
  276. ;;
  277. (spec)
  278. __pod-spec
  279. ;;
  280. (ipc)
  281. __pod-ipc
  282. ;;
  283. (list)
  284. __pod-list
  285. ;;
  286. (install)
  287. _arguments \
  288. $_inherited_options \
  289. $_install_options
  290. ;;
  291. (update)
  292. _arguments \
  293. $_inherited_options \
  294. $_update_options
  295. ;;
  296. (outdated)
  297. _arguments \
  298. $_inherited_options \
  299. $_outdated_options
  300. ;;
  301. (search)
  302. _arguments \
  303. $_inherited_options \
  304. $_search_options
  305. ;;
  306. (podfile-info)
  307. _arguments \
  308. $_inherited_options \
  309. $_podfile_info_options
  310. ;;
  311. (setup)
  312. _arguments \
  313. $_inherited_options \
  314. $_setup_options
  315. ;;
  316. esac
  317. ;;
  318. esac