_pod 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. #compdef pod
  2. #autoload
  3. # -----------------------------------------------------------------------------
  4. # FILE: _pod
  5. # DESCRIPTION: Cocoapods (0.33.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.4
  11. # -----------------------------------------------------------------------------
  12. local -a _1st_arguments
  13. _1st_arguments=(
  14. 'help:Show help for the given command.'
  15. 'init:Generate a Podfile for the current directory.'
  16. 'install:Install project dependencies'
  17. 'ipc:Inter-process communication'
  18. 'lib:Develop pods'
  19. 'list:List pods'
  20. 'outdated:Show outdated project dependencies'
  21. 'plugins:Show available CocoaPods plugins'
  22. 'push:Temporary alias for the `pod repo push` command'
  23. 'repo:Manage spec-repositories'
  24. 'search:Searches for pods'
  25. 'setup:Setup the CocoaPods environment'
  26. 'spec:Manage pod specs'
  27. 'trunk:Interact with trunk.cocoapods.org'
  28. 'try:Try a Pod!'
  29. 'update:Update outdated project dependencies'
  30. )
  31. local -a _repo_arguments
  32. _repo_arguments=(
  33. 'add:Add a spec repo'
  34. 'lint:Validates all specs in a repo'
  35. 'push:Push new specifications to a spec-repo'
  36. 'remove:Remove a spec repo.'
  37. 'update:Update a spec repo'
  38. )
  39. local -a _spec_arguments
  40. _spec_arguments=(
  41. 'cat:Prints a spec file'
  42. 'create:Create spec file stub'
  43. 'edit:Edit a spec file'
  44. 'lint:Validates a spec file'
  45. 'which:Prints the path of the given spec'
  46. )
  47. local -a _ipc_arguments
  48. _ipc_arguments=(
  49. 'list:Lists the specifications know to CocoaPods'
  50. 'podfile:Converts a Podfile to YAML'
  51. 'repl:The repl listens to commands on standard input'
  52. 'spec:Converts a podspec to JSON'
  53. 'update-search-index:Updates the search index'
  54. )
  55. local -a _lib_arguments
  56. _lib_arguments=(
  57. 'create:Creates a new Pod'
  58. 'lint:Validates a Pod'
  59. )
  60. local -a _plugins_arguments
  61. _plugins_arguments=(
  62. 'create:Creates a new plugin'
  63. 'list:List all known plugins'
  64. 'search:Search for known plugins'
  65. )
  66. local -a _list_arguments
  67. _list_arguments=(
  68. 'new:Lists pods introduced in the master spec-repo since the last check'
  69. )
  70. local -a _trunk_arguments
  71. _trunk_arguments=(
  72. 'add-owner:Add an owner to a pod'
  73. 'me:Display information about your sessions'
  74. 'push:Publish a podspec'
  75. 'register:Manage sessions'
  76. )
  77. local -a _trunk_me_arguments
  78. _trunk_me_arguments=(
  79. 'clean-sessions:Remove sessions'
  80. )
  81. local -a _inherited_options
  82. _inherited_options=(
  83. '(--silent)--silent[Show nothing]' \
  84. '(--verbose)--verbose[Show more debugging information]' \
  85. '(--no-ansi)--no-ansi[Show output without ANSI codes]' \
  86. '(--help)--help[Show help banner of specified command]'
  87. )
  88. local -a _root_options
  89. _root_options=(
  90. '(--version)--version[Show the version of CocoaPods]' \
  91. '(--completion-script)--completion-script[Print the auto-completion script]'
  92. )
  93. local -a _install_options
  94. _install_options=(
  95. '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn` intact after downloading]' \
  96. '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \
  97. '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]'
  98. )
  99. local -a _lib_lint_options
  100. _lib_lint_options=(
  101. '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \
  102. '(--only-errors)--only-errors[Lint validates even if warnings are present]' \
  103. '(--subspec=NAME)--subspec=[Lint validates only the given subspec]' \
  104. '(--no-subspecs)--no-subspecs[Lint skips validation of subspecs]' \
  105. '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]'
  106. )
  107. local -a _update_options
  108. _update_options=(
  109. '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn intact after downloading]' \
  110. '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \
  111. '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]'
  112. )
  113. local -a _outdated_options
  114. _outdated_options=(
  115. '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]'
  116. )
  117. local -a _search_options
  118. _search_options=(
  119. '(--full)--full[Search by name, summary, and description]' \
  120. '(--stats)--stats[Show additional stats (like GitHub watchers and forks)]' \
  121. '(--ios)--ios[Restricts the search to Pods supported on iOS]' \
  122. '(--osx)--osx[Restricts the search to Pods supported on OS X]' \
  123. '(--web)--web[Searches on cocoapods.org]'
  124. )
  125. local -a _list_options
  126. _list_options=(
  127. '(--update)--update[Run `pod repo update` before listing]'
  128. )
  129. local -a _plugins_search_options
  130. _plugins_search_options=(
  131. '(--full)--full[Search by name, author, and description]'
  132. )
  133. local -a _repo_push_options
  134. _repo_push_options=(
  135. '(--allow-warnings)--allow-warnings[Allows pushing even if there are warnings]' \
  136. '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' \
  137. '*:script or directory:_files'
  138. )
  139. local -a _repo_add_options
  140. _repo_add_options=(
  141. '(--shallow)--shallow[Create a shallow clone (fast clone, but no push capabilities)]'
  142. )
  143. local -a _repo_lint_options
  144. _repo_lint_options=(
  145. '(--only-errors)--only-errors[Lint presents only the errors]'
  146. )
  147. local -a _setup_options
  148. _setup_options=(
  149. '(--no-shallow)--no-shallow[Clone full history so push will work]'
  150. '(--push)--push[Use this option to enable push access once granted]'
  151. )
  152. local -a _spec_lint_options
  153. _spec_lint_options=(
  154. '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \
  155. '(--only-errors)--only-errors[Lint validates even if warnings are present]' \
  156. '(--subspec=NAME)--subspec=[Lint validates only the given subspec]' \
  157. '(--no-subspecs)--no-subspecs[Lint skips validation of subspecs]' \
  158. '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' \
  159. '*:script or directory:_files'
  160. )
  161. local -a _spec_cat_options
  162. _spec_cat_options=(
  163. '(--show-all)--show-all[Pick from all versions of the given podspec]'
  164. )
  165. local -a _spec_which_options
  166. _spec_which_options=(
  167. '(--show-all)--show-all[Print all versions of the given podspec]'
  168. )
  169. local -a _spec_edit_options
  170. _spec_edit_options=(
  171. '(--show-all)--show-all[Pick which spec to edit from all available versions of the given podspec]'
  172. )
  173. local -a _trunk_register_options
  174. _trunk_register_options=(
  175. '(--description=DESCRIPTION)--description=[An arbitrary description to easily identify your session later on.]'
  176. )
  177. __first_command_list ()
  178. {
  179. local expl
  180. declare -a tasks
  181. tasks=(install ipc list outdated podfile-info push repo search setup spec update)
  182. _wanted tasks expl 'help' compadd $tasks
  183. }
  184. __repo_list() {
  185. _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods/repos 2>/dev/null | sed -e 's/ /\\ /g')
  186. }
  187. __pod-repo() {
  188. local curcontext="$curcontext" state line
  189. typeset -A opt_args
  190. _arguments -C \
  191. ':command:->command' \
  192. '*::options:->options'
  193. case $state in
  194. (command)
  195. _describe -t commands "pod repo" _repo_arguments
  196. return
  197. ;;
  198. (options)
  199. case $line[1] in
  200. (lint)
  201. _arguments \
  202. $_inherited_options \
  203. $_repo_lint_options \
  204. ':feature:__repo_list'
  205. ;;
  206. (update)
  207. _arguments \
  208. $_inherited_options \
  209. ':feature:__repo_list'
  210. ;;
  211. (push)
  212. _arguments \
  213. $_inherited_options \
  214. $_repo_push_options \
  215. ':feature:__repo_list'
  216. ;;
  217. (add)
  218. _arguments \
  219. $_inherited_options \
  220. $_repo_add_options
  221. (remove)
  222. _arguments \
  223. $_inherited_options \
  224. ':feature:__repo_list'
  225. ;;
  226. esac
  227. ;;
  228. esac
  229. }
  230. __pod-spec() {
  231. local curcontext="$curcontext" state line
  232. typeset -A opt_args
  233. _arguments -C \
  234. $_inherited_options \
  235. ':command:->command' \
  236. '*::options:->options'
  237. case $state in
  238. (command)
  239. _describe -t commands "pod spec" _spec_arguments
  240. return
  241. ;;
  242. (options)
  243. case $line[1] in
  244. (create)
  245. _arguments \
  246. $_inherited_options
  247. ;;
  248. (lint)
  249. _arguments \
  250. $_inherited_options \
  251. $_spec_lint_options
  252. ;;
  253. (cat)
  254. _arguments \
  255. $_inherited_options \
  256. $_spec_cat_options
  257. ;;
  258. (which)
  259. _arguments \
  260. $_inherited_options \
  261. $_spec_which_options
  262. ;;
  263. (edit)
  264. _arguments \
  265. $_inherited_options \
  266. $_spec_edit_options
  267. ;;
  268. esac
  269. return
  270. ;;
  271. esac
  272. }
  273. __pod-ipc() {
  274. local curcontext="$curcontext" state line
  275. typeset -A opt_args
  276. _arguments -C \
  277. ':command:->command' \
  278. '*::options:->options'
  279. case $state in
  280. (command)
  281. _describe -t commands "pod ipc" _ipc_arguments
  282. return
  283. ;;
  284. (options)
  285. _arguments -C \
  286. $_inherited_options
  287. return
  288. ;;
  289. esac
  290. }
  291. __pod-lib() {
  292. local curcontext="$curcontext" state line
  293. typeset -A opt_args
  294. _arguments -C \
  295. ':command:->command' \
  296. '*::options:->options'
  297. case $state in
  298. (command)
  299. _describe -t commands "pod lib" _lib_arguments
  300. return
  301. ;;
  302. (options)
  303. case $line[1] in
  304. (create)
  305. _arguments \
  306. $_inherited_options
  307. ;;
  308. (lint)
  309. _arguments \
  310. $_inherited_options \
  311. $_lib_lint_options
  312. ;;
  313. esac
  314. return
  315. ;;
  316. esac
  317. }
  318. __pod-plugins() {
  319. local curcontext="$curcontext" state line
  320. typeset -A opt_args
  321. _arguments -C \
  322. $_inherited_options \
  323. ':command:->command' \
  324. '*::options:->options'
  325. case $state in
  326. (command)
  327. _describe -t commands "pod plugins" _plugins_arguments
  328. return
  329. ;;
  330. (options)
  331. case $line[1] in
  332. (create)
  333. _arguments \
  334. $_inherited_options
  335. ;;
  336. (list)
  337. _arguments \
  338. $_inherited_options
  339. ;;
  340. (search)
  341. _arguments \
  342. $_inherited_options \
  343. $_plugins_search_options
  344. ;;
  345. esac
  346. return
  347. ;;
  348. esac
  349. }
  350. __pod-trunk() {
  351. local curcontext="$curcontext" state line
  352. typeset -A opt_args
  353. _arguments -C \
  354. $_inherited_options \
  355. ':command:->command' \
  356. '*::options:->options'
  357. case $state in
  358. (command)
  359. _describe -t commands "pod trunk" _trunk_arguments
  360. return
  361. ;;
  362. (options)
  363. case $line[1] in
  364. (add-owner)
  365. _arguments \
  366. $_inherited_options
  367. ;;
  368. (me)
  369. __pod-trunk-me
  370. ;;
  371. (push)
  372. _arguments \
  373. $_inherited_options
  374. ;;
  375. (register)
  376. _arguments \
  377. $_inherited_options \
  378. $_trunk_register_options
  379. ;;
  380. esac
  381. return
  382. ;;
  383. esac
  384. }
  385. __pod-trunk-me() {
  386. local curcontext="$curcontext" state line
  387. typeset -A opt_args
  388. _arguments -C \
  389. $_inherited_options \
  390. ':command:->command' \
  391. '*::options:->options'
  392. case $state in
  393. (command)
  394. _describe -t commands "pod trunk me" _trunk_me_arguments
  395. return
  396. ;;
  397. (options)
  398. case $line[1] in
  399. (clean-sessions)
  400. _arguments \
  401. $_inherited_options
  402. ;;
  403. esac
  404. return
  405. ;;
  406. esac
  407. }
  408. __pod-list() {
  409. local curcontext="$curcontext" state line
  410. typeset -A opt_args
  411. _arguments -C \
  412. $_inherited_options \
  413. $_list_options \
  414. ':command:->command' \
  415. '*::options:->options'
  416. case $state in
  417. (command)
  418. _describe -t commands "pod list" _list_arguments
  419. return
  420. ;;
  421. (options)
  422. _arguments -C \
  423. $_inherited_options \
  424. $_list_options
  425. return
  426. ;;
  427. esac
  428. }
  429. local curcontext="$curcontext" state line
  430. typeset -A opt_args
  431. _arguments -C \
  432. $_inherited_options \
  433. ':command:->command' \
  434. '*::options:->options'
  435. case $state in
  436. (command)
  437. _describe -t commands "pod" _1st_arguments
  438. _arguments \
  439. $_inherited_options \
  440. $_root_options
  441. return
  442. ;;
  443. (options)
  444. case $line[1] in
  445. (help)
  446. _arguments \
  447. $_inherited_options \
  448. ':help:__first_command_list'
  449. ;;
  450. (init)
  451. _arguments \
  452. $_inherited_options
  453. ;;
  454. (push)
  455. _arguments \
  456. $_inherited_options \
  457. $_repo_push_options \
  458. ':repo:__repo_list'
  459. ;;
  460. (repo)
  461. __pod-repo
  462. ;;
  463. (spec)
  464. __pod-spec
  465. ;;
  466. (ipc)
  467. __pod-ipc
  468. ;;
  469. (lib)
  470. __pod-lib
  471. ;;
  472. (list)
  473. __pod-list
  474. ;;
  475. (install)
  476. _arguments \
  477. $_inherited_options \
  478. $_install_options
  479. ;;
  480. (update)
  481. _arguments \
  482. $_inherited_options \
  483. $_update_options
  484. ;;
  485. (outdated)
  486. _arguments \
  487. $_inherited_options \
  488. $_outdated_options
  489. ;;
  490. (plugins)
  491. __pod-plugins
  492. ;;
  493. (trunk)
  494. __pod-trunk
  495. ;;
  496. (try)
  497. _arguments \
  498. $_inherited_options
  499. ;;
  500. (search)
  501. _arguments \
  502. $_inherited_options \
  503. $_search_options
  504. ;;
  505. (setup)
  506. _arguments \
  507. $_inherited_options \
  508. $_setup_options
  509. ;;
  510. esac
  511. ;;
  512. esac