My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_cf 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. #compdef cf
  2. # ------------------------------------------------------------------------------
  3. #
  4. # Copyright 2015 Ferran Rodenas & Danny Rosen
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. # ------------------------------------------------------------------------------
  19. #
  20. # Description
  21. # -----------
  22. #
  23. # Completion script for Cloud Foundry CLI (https://github.com/cloudfoundry/cli#downloads)
  24. #
  25. # ------------------------------------------------------------------------------
  26. #
  27. # Authors
  28. # -------
  29. #
  30. # * Ferran Rodenas (https://github.com/frodenas)
  31. # * Danny Rosen (https://github.com/dannyzen)
  32. #
  33. # ------------------------------------------------------------------------------
  34. # ----------------------
  35. # ----- Helper functions
  36. # ----------------------
  37. # Output a selectable list of organizations
  38. __cf_orgs() {
  39. declare -a cont_cmd
  40. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf orgs | awk 'NR>3{print $1}'))
  41. if [[ 'X$cont_cmd' != 'X' ]]
  42. _describe 'ORG' cont_cmd
  43. }
  44. # Output a selectable list of spaces
  45. __cf_spaces() {
  46. declare -a cont_cmd
  47. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf spaces | awk 'NR>3{print $1}'))
  48. if [[ 'X$cont_cmd' != 'X' ]]
  49. _describe 'SPACE' cont_cmd
  50. }
  51. # Output a selectable list of applications
  52. __cf_apps() {
  53. declare -a cont_cmd
  54. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf apps | awk 'NR>4{print $1}'))
  55. if [[ 'X$cont_cmd' != 'X' ]]
  56. _describe 'APP' cont_cmd
  57. }
  58. # Output a selectable list of stacks
  59. __cf_stacks() {
  60. declare -a cont_cmd
  61. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf stacks | awk 'NR>4{print $1}'))
  62. if [[ 'X$cont_cmd' != 'X' ]]
  63. _describe 'STACK' cont_cmd
  64. }
  65. # Output a selectable list of services
  66. __cf_marketplace_services() {
  67. declare -a cont_cmd
  68. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf marketplace | awk 'NR>4{print $1}'))
  69. if [[ 'X$cont_cmd' != 'X' ]]
  70. _describe 'SERVICE' cont_cmd
  71. }
  72. # Output a selectable list of services
  73. __cf_services() {
  74. declare -a cont_cmd
  75. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf services | awk 'NR>4{print $1}'))
  76. if [[ 'X$cont_cmd' != 'X' ]]
  77. _describe 'SERVICE' cont_cmd
  78. }
  79. # Output a selectable list of domains
  80. __cf_domains() {
  81. declare -a cont_cmd
  82. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v shared | awk 'NR>2{print $1}'))
  83. if [[ 'X$cont_cmd' != 'X' ]]
  84. _describe 'DOMAIN' cont_cmd
  85. }
  86. # Output a selectable list of shared domains
  87. __cf_shared_domains() {
  88. declare -a cont_cmd
  89. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v owned | awk 'NR>2{print $1}'))
  90. if [[ 'X$cont_cmd' != 'X' ]]
  91. _describe 'SHARED-DOMAIN' cont_cmd
  92. }
  93. # Output a selectable list of hostnames
  94. __cf_hostnames() {
  95. declare -a cont_cmd
  96. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf routes | awk 'NR>3{print $2}'))
  97. if [[ 'X$cont_cmd' != 'X' ]]
  98. _describe 'ROUTE' cont_cmd
  99. }
  100. # Output a selectable list of buildpacks
  101. __cf_buildpacks() {
  102. declare -a cont_cmd
  103. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf buildpacks | awk 'NR>3{print $1}'))
  104. if [[ 'X$cont_cmd' != 'X' ]]
  105. _describe 'BUILDPACK' cont_cmd
  106. }
  107. # Output a selectable list of feature flags
  108. __cf_feature_flags() {
  109. declare -a cont_cmd
  110. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf feature-flags | awk 'NR>4{print $1}'))
  111. if [[ 'X$cont_cmd' != 'X' ]]
  112. _describe 'FEATURE-FLAG' cont_cmd
  113. }
  114. # Output a selectable list of plugin repos
  115. __cf_repo_plugins() {
  116. declare -a cont_cmd
  117. cont_cmd=($(CF_COLOR=false CF_TRACE=false cf list-plugin-repos | awk 'NR>3{print $1}'))
  118. if [[ 'X$cont_cmd' != 'X' ]]
  119. _describe 'REPO-PLUGIN' cont_cmd
  120. }
  121. # Output a selectable list of plugins
  122. __cf_plugins() {
  123. declare -a cont_cmd
  124. cont_cmd=($(cf plugins | awk 'NR>4{print $1}'))
  125. if [[ 'X$cont_cmd' != 'X' ]]
  126. _describe 'PLUGIN' cont_cmd
  127. }
  128. # --------------------------
  129. # ----- end Helper functions
  130. # --------------------------
  131. # --------------
  132. # ----- Commands
  133. # --------------
  134. __login() {
  135. _arguments \
  136. '-a=[API endpoint (e.g. https://api.example.com)]:api endpoint:' \
  137. '-u=[Username]:username:' \
  138. '-p=[Password]:password:' \
  139. '-o=[Organization]:organization name:' \
  140. '-s=[Space]:space name:' \
  141. '--sso[Use a one-time password to login]' \
  142. '--skip-ssl-validation[Skip SSL validation]'
  143. }
  144. __logout() {
  145. # no arguments
  146. }
  147. __passwd() {
  148. _arguments \
  149. '1:password:'
  150. }
  151. __target() {
  152. _arguments \
  153. '-o=[Organization]:organization name:__cf_orgs' \
  154. '-s=[Space]:space name:__cf_spaces'
  155. }
  156. __api() {
  157. _arguments \
  158. '1:API url:' \
  159. '--unset[Remove all api endpoint targeting]' \
  160. '--skip-ssl-validation[Skip SSL validation]'
  161. }
  162. __auth() {
  163. # no arguments
  164. }
  165. __apps() {
  166. # no arguments
  167. }
  168. __app() {
  169. _arguments \
  170. '1:application name:__cf_apps' \
  171. '--guid[Retrieve and display the given app guid. All other health and status output for the app is suppressed]'
  172. }
  173. __push() {
  174. _arguments \
  175. '1:application name:' \
  176. '-b=[Custom buildpack by name (e.g. my-buildpack) or GIT URL or GIT BRANCH URL]' \
  177. '-c=[Startup command, set to null to reset to default start command]:startup command:' \
  178. '-d=[Domain (e.g. example.com)]:domain (e.g. example.com):__cf_domains' \
  179. '-f=[Path to manifest]:file:_files:' \
  180. '-i=[Number of instances]:number of instances:' \
  181. '-k=[Disk limit (e.g. 256M, 1024M, 1G)]:disk limit (e.g. 256M, 1024M, 1G):' \
  182. '-m=[Memory limit (e.g. 256M, 1024M, 1G)]:memory limit (e.g. 256M, 1024M, 1G):' \
  183. '-n=[Hostname (e.g. my-subdomain)]:hostname (e.g. my-subdomain):' \
  184. '-p=[Path to app directory or to a zip file of the contents of the app directory]:file:_files' \
  185. '-s=[Stack to use (a stack is a pre-built file system, including an operating system, that can run apps)]:stack name:__cf_stacks:' \
  186. '-t=[Maximum time (in seconds) for CLI to wait for application start, other server side timeouts may apply]:maximum time (in seconds):' \
  187. '--no-hostname[Map the root domain to this app]' \
  188. '--no-manifest[Ignore manifest file]' \
  189. '--no-route[Do not map a route to this app and remove routes from previous pushes of this app]' \
  190. '--no-start[Do not start an app after pushing]' \
  191. '--random-route[Create a random route for this app]'
  192. }
  193. __scale() {
  194. _arguments \
  195. '1:application name:__cf_apps' \
  196. '-i=[Number of instances]:number of instances:' \
  197. '-k=[Disk limit (e.g. 256M, 1024M, 1G)]:disk limit (e.g. 256M, 1024M, 1G):' \
  198. '-m=[Memory limit (e.g. 256M, 1024M, 1G)]:memory limit (e.g. 256M, 1024M, 1G):' \
  199. '-f[Force restart of app without prompt]'
  200. }
  201. __delete() {
  202. _arguments \
  203. '1:application name:__cf_apps' \
  204. '--f[Force deletion without confirmation]' \
  205. '--r[Also delete any mapped routes]'
  206. }
  207. __rename() {
  208. _arguments \
  209. '1:application name:__cf_apps' \
  210. '2:application name:'
  211. }
  212. __start() {
  213. _arguments \
  214. '1:application name:__cf_apps'
  215. }
  216. __stop() {
  217. _arguments \
  218. '1:application name:__cf_apps'
  219. }
  220. __restart() {
  221. _arguments \
  222. '1:application name:__cf_apps'
  223. }
  224. __restage() {
  225. _arguments \
  226. '1:application name:__cf_apps'
  227. }
  228. __restart-app-instance() {
  229. _arguments \
  230. '1:application name:__cf_apps' \
  231. '2:application index:'
  232. }
  233. __events() {
  234. _arguments \
  235. '1:application name:__cf_apps'
  236. }
  237. __files() {
  238. _arguments \
  239. '1:application name:__cf_apps' \
  240. '2::path:' \
  241. '-i=[instance]'
  242. }
  243. __logs() {
  244. _arguments \
  245. '1:application name:__cf_apps' \
  246. '--recent[Dump recent logs instead of tailing]'
  247. }
  248. __env() {
  249. _arguments \
  250. '1:application name:__cf_apps'
  251. }
  252. __set-env() {
  253. _arguments \
  254. '1:application name:__cf_apps' \
  255. '2:env var name:' \
  256. '3:env var value:'
  257. }
  258. __unset-env() {
  259. _arguments \
  260. '1:application name:__cf_apps' \
  261. '2:env var name:'
  262. }
  263. __stacks() {
  264. # no arguments
  265. }
  266. __stack() {
  267. _arguments \
  268. '1:stack name:__cf_stacks' \
  269. '--guid[Retrieve and display the given stack guid. All other output for the stack is suppressed]'
  270. }
  271. __copy-source() {
  272. _arguments \
  273. '1:source application name:__cf_apps' \
  274. '2:target application name:' \
  275. '-o=[Org that contains the target application]:organization name:__cf_orgs' \
  276. '-s=[Space that contains the target application]:space name:__cf_spaces' \
  277. '--no-restart[Override restart of the application in target environment after copy-source completes]'
  278. }
  279. __create-app-manifest() {
  280. _arguments \
  281. '1:application name:__cf_apps' \
  282. '-p=[Specify a path for file creation. If path not specified, manifest file is created in current working directory]:path:_files'
  283. }
  284. __marketplace() {
  285. _arguments \
  286. '-s=[Show plan details for a particular service offering]'
  287. }
  288. __services() {
  289. # no arguments
  290. }
  291. __service() {
  292. _arguments \
  293. '1:service name:__cf_services' \
  294. '--guid[Retrieve and display the given service guid. All other output for the service is suppressed]'
  295. }
  296. __create-service() {
  297. _arguments \
  298. '1:service:__cf_marketplace_services' \
  299. '2:plan:' \
  300. '3:service name:' \
  301. '-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]' \
  302. '-t=[User provided tags]'
  303. }
  304. __update-service() {
  305. _arguments \
  306. '1:service name:__cf_services' \
  307. '-p=[Change service plan for a service instance]' \
  308. '-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]' \
  309. '-t=[User provided tags]'
  310. }
  311. __rename-service() {
  312. _arguments \
  313. '1:service name:__cf_services' \
  314. '2:service name:'
  315. }
  316. __delete-service() {
  317. _arguments \
  318. '1:service name:__cf_services' \
  319. '-f[Force deletion without confirmation]'
  320. }
  321. __create-service-key() {
  322. _arguments \
  323. '1:service name:__cf_services' \
  324. '2:service key:' \
  325. '-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]'
  326. }
  327. __service-keys() {
  328. _arguments \
  329. '1:service name:__cf_services'
  330. }
  331. __service-key() {
  332. _arguments \
  333. '1:service name:__cf_services' \
  334. '2:service key:'
  335. }
  336. __delete-service-key() {
  337. _arguments \
  338. '1:service name:__cf_services' \
  339. '2:service key:' \
  340. '-f[Force deletion without confirmation]'
  341. }
  342. __bind-service() {
  343. _arguments \
  344. '1:application name:__cf_apps' \
  345. '2:service name:__cf_services' \
  346. '-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]'
  347. }
  348. __unbind-service() {
  349. _arguments \
  350. '1:application name:__cf_apps' \
  351. '2:service name:__cf_services'
  352. }
  353. __create-user-provided-service() {
  354. _arguments \
  355. '1:service name:' \
  356. '-p=[Credentials]' \
  357. '-l=[Syslog Drain Url]'
  358. }
  359. __update-user-provided-service() {
  360. _arguments \
  361. '1:service name:__cf_services' \
  362. '-p=[Credentials]' \
  363. '-l=[Syslog Drain Url]'
  364. }
  365. __orgs() {
  366. # no arguments
  367. }
  368. __org() {
  369. _arguments \
  370. '1:organization name:__cf_orgs' \
  371. '--guid[Retrieve and display the given org guid. All other output for the org is suppressed]'
  372. }
  373. __create-org() {
  374. _arguments \
  375. '1:organization name:' \
  376. '-q=[Quota to assign to the newly created org (excluding this option results in assignment of default quota)]'
  377. }
  378. __delete-org() {
  379. _arguments \
  380. '1:organization name:__cf_orgs' \
  381. '-f[Force deletion without confirmation]'
  382. }
  383. __spaces() {
  384. # no arguments
  385. }
  386. __space() {
  387. _arguments \
  388. '1:space name:__cf_spaces' \
  389. '--guid[Retrieve and display the given space guid. All other output for the space is suppressed]' \
  390. '--security-group-rules[Retrive the rules for all the security groups associated with the space]'
  391. }
  392. __create-space() {
  393. _arguments \
  394. '1:space name:' \
  395. '-o=[Org that contains the target application]:organization name:__cf_orgs' \
  396. '-q=[Quota to assign to the newly created space (excluding this option results in assignment of default quota)]'
  397. }
  398. __delete-space() {
  399. _arguments \
  400. '1:space name:__cf_spaces' \
  401. '-f[Force deletion without confirmation]'
  402. }
  403. __domains() {
  404. # no arguments
  405. }
  406. __create-domain() {
  407. _arguments \
  408. '1:organization name:__cf_orgs' \
  409. '2:domain:'
  410. }
  411. __delete-domain() {
  412. _arguments \
  413. '1:domain:__cf_domains' \
  414. '-f[Force deletion without confirmation]'
  415. }
  416. __create-shared-domain() {
  417. _arguments \
  418. '1:domain:'
  419. }
  420. __delete-shared-domain() {
  421. _arguments \
  422. '1:domain:__cf_shared_domains' \
  423. '-f[Force deletion without confirmation]'
  424. }
  425. __routes() {
  426. _arguments \
  427. '--orglevel[List all the routes for all spaces of current organization]'
  428. }
  429. __create-route() {
  430. _arguments \
  431. '1:space name:__cf_spaces' \
  432. '2:domain:__cf_domains' \
  433. '-n=[Hostname]'
  434. }
  435. __check-route() {
  436. _arguments \
  437. '1:hostname:__cf_hostnames' \
  438. '2:domain:__cf_domains'
  439. }
  440. __map-route() {
  441. _arguments \
  442. '1:application name:__cf_apps' \
  443. '2:domain:__cf_domains' \
  444. '-n=[Hostname]:hostname:__cf_hostnames:'
  445. }
  446. __unmap-route() {
  447. _arguments \
  448. '1:application name:__cf_apps' \
  449. '2:domain:__cf_domains' \
  450. '-n=[Hostname]:hostname:__cf_hostnames:'
  451. }
  452. __delete-route() {
  453. _arguments \
  454. '1:domain:__cf_domains' \
  455. '-n=[Hostname]:hostname:__cf_hostnames:' \
  456. '-f[Force deletion without confirmation]'
  457. }
  458. __delete-orphaned-routes() {
  459. _arguments \
  460. '-f[Force deletion without confirmation]'
  461. }
  462. __buildpacks() {
  463. # no arguments
  464. }
  465. __create-buildpack() {
  466. _arguments \
  467. '1:buildpack name:' \
  468. '2:path:_files' \
  469. '3:position:' \
  470. '--enable[Enable the buildpack to be used for staging]' \
  471. '--disable[Disable the buildpack from being used for staging]'
  472. }
  473. __update-buildpack() {
  474. _arguments \
  475. '1:buildpack name:__cf_buildpacks' \
  476. '-p=[Path to directory or zip file]:file:_files' \
  477. '-i=[The order in which the buildpacks are checked during buildpack auto-detection]' \
  478. '--enable[Enable the buildpack to be used for staging]' \
  479. '--disable[Disable the buildpack from being used for staging]' \
  480. '--lock[Lock the buildpack to prevent updates]' \
  481. '--unlock[Unlock the buildpack to enable updates]'
  482. }
  483. __rename-buildpack() {
  484. _arguments \
  485. '1:buildpack name:__cf_buildpacks' \
  486. '2:new buildpack name:'
  487. }
  488. __delete-buildpack() {
  489. _arguments \
  490. '1:buildpack name:__cf_buildpacks' \
  491. '-f[Force deletion without confirmation]'
  492. }
  493. __running-environment-variable-group() {
  494. # no arguments
  495. }
  496. __staging-environment-variable-group() {
  497. # no arguments
  498. }
  499. __set-staging-environment-variable-group() {
  500. # no arguments
  501. }
  502. __set-running-environment-variable-group() {
  503. # no arguments
  504. }
  505. __feature-flags() {
  506. # no arguments
  507. }
  508. __feature-flag() {
  509. _arguments \
  510. '1:feature name:__cf_feature_flags'
  511. }
  512. __enable-feature-flag() {
  513. _arguments \
  514. '1:feature name:__cf_feature_flags'
  515. }
  516. __disable-feature-flag() {
  517. _arguments \
  518. '1:feature name:__cf_feature_flags'
  519. }
  520. __curl() {
  521. _arguments \
  522. '1:path:' \
  523. '-i[Include response headers in the output]' \
  524. '-v[Enable CF_TRACE output for all requests and responses]' \
  525. '-X=[HTTP method]:http method:(GET POST PUT DELETE)' \
  526. '-h=[Custom headers to include in the request, flag can be specified multiple times]' \
  527. '-d=[HTTP data to include in the request body]' \
  528. '--output[Write curl body to FILE instead of stdout]'
  529. }
  530. __config() {
  531. _arguments \
  532. '--async-timeout=[Timeout for async HTTP requests]' \
  533. '--trace=[Trace HTTP requests]:trace:(true false)' \
  534. '--color=[Enable or disable color]:color:(true false)' \
  535. '--locale=[Set default locale. If LOCALE is CLEAR, previous locale is deleted]'
  536. }
  537. __oauth-token() {
  538. # no arguments
  539. }
  540. __add-plugin-repo() {
  541. _arguments \
  542. '1:repo name:' \
  543. '2:url:'
  544. }
  545. __remove-plugin-repo() {
  546. _arguments \
  547. '1:repo name:__cf_repo_plugins' \
  548. '2:url:'
  549. }
  550. __list-plugin-repos() {
  551. # no arguments
  552. }
  553. __repo-plugins() {
  554. _arguments \
  555. '-r=[Repo Name]:repo name:__cf_repo_plugins'
  556. }
  557. __plugins() {
  558. _arguments \
  559. '-checksum[Compute and show the sha1 value of the plugin binary file]'
  560. }
  561. __install-plugin() {
  562. _arguments \
  563. '1:plugin URL or path:_files' \
  564. '-r=[repo name where the plugin binary is located]:repo name:__cf_repo_plugins'
  565. }
  566. __uninstall-plugin() {
  567. _arguments \
  568. '1:plugin name:__cf_plugins'
  569. }
  570. # ------------------
  571. # ----- end Commands
  572. # ------------------
  573. # -------------------
  574. # ----- 1st Arguments
  575. # -------------------
  576. local -a _1st_arguments
  577. _1st_arguments=(
  578. "login":"Log user in"
  579. "logout":"Log user out"
  580. "passwd":"Change user password"
  581. "target":"Set or view the targeted org or space"
  582. "api":"Set or view target api url"
  583. "auth":"Authenticate user non-interactively"
  584. "apps":"List all apps in the target space"
  585. "app":"Display health and status for app"
  586. "push":"Push a new app or sync changes to an existing app"
  587. "scale":"Change or view the instance count, disk space limit, and memory limit for an app"
  588. "delete":"Delete an app"
  589. "rename":"Rename an app"
  590. "start":"Start an app"
  591. "stop":"Stop an app"
  592. "restart":"Restart an app"
  593. "restage":"Restage an app"
  594. "restart-app-instance":"Terminate the running application Instance at the given index and instantiate a new instance of the application with the same index"
  595. "events":"Show recent app events"
  596. "files":"Print out a list of files in a directory or the contents of a specific file"
  597. "logs":"Tail or show recent logs for an app"
  598. "env":"Show all env variables for an app"
  599. "set-env":"Set an env variable for an app"
  600. "unset-env":"Remove an env variable"
  601. "stacks":"List all stacks"
  602. "stack":"Show information for a stack"
  603. "copy-source":"Make a copy of app source code from one application to another. Unless overridden, the copy-source command will restart the application"
  604. "create-app-manifest":"Create an app manifest for an app that has been pushed successfully"
  605. "marketplace":"List available offerings in the marketplace"
  606. "services":"List all service instances in the target space"
  607. "service":"Show service instance info"
  608. "create-service":"Create a service instance"
  609. "update-service":"Update a service instance"
  610. "delete-service":"Delete a service instance"
  611. "rename-service":"Rename a service instance"
  612. "create-service-key":"Create key for a service instance"
  613. "service-keys":"List keys for a service instance"
  614. "service-key":"Show service key info"
  615. "delete-service-key":"Delete a service key"
  616. "bind-service":"Bind a service instance to an app"
  617. "unbind-service":"Unbind a service instance from an app"
  618. "create-user-provided-service":"Make a user-provided service instance available to cf apps"
  619. "update-user-provided-service":"Update user-provided service instance name value pairs"
  620. "orgs":"List all orgs"
  621. "org":"Show org info"
  622. "create-org":"Create an org"
  623. "delete-org":"Delete an org"
  624. "rename-org":"Rename an org"
  625. "spaces":"List all spaces in an org"
  626. "space":"Show space info"
  627. "create-space":"Create a space"
  628. "delete-space":"Delete a space"
  629. "rename-space":"Rename a space"
  630. "domains":"List domains in the target org"
  631. "create-domain":"Create a domain in an org for later use"
  632. "delete-domain":"Delete a domain"
  633. "create-shared-domain":"Create a domain that can be used by all orgs (admin-only)"
  634. "delete-shared-domain":"Delete a shared domain"
  635. "routes":"List all routes in the current space or the current organization"
  636. "create-route":"Create a url route in a space for later use"
  637. "check-route":"Perform a simple check to determine whether a route currently exists or not"
  638. "map-route":"Add a url route to an app"
  639. "unmap-route":"Remove a url route from an app"
  640. "delete-route":"Delete a route"
  641. "delete-orphaned-routes":"Delete all orphaned routes (e.g.: those that are not mapped to an app)"
  642. "buildpacks":"List all buildpacks"
  643. "create-buildpack":"Create a buildpack"
  644. "update-buildpack":"Update a buildpack"
  645. "rename-buildpack":"Rename a buildpack"
  646. "delete-buildpack":"Delete a buildpack"
  647. "running-environment-variable-group":"Retrieve the contents of the running environment variable group"
  648. "staging-environment-variable-group":"Retrieve the contents of the staging environment variable group"
  649. "set-staging-environment-variable-group":"Pass parameters as JSON to create a staging environment variable group"
  650. "set-running-environment-variable-group":"Pass parameters as JSON to create a running environment variable group"
  651. "feature-flags":"Retrieve list of feature flags with status of each flag-able feature"
  652. "feature-flag":"Retrieve an individual feature flag with status"
  653. "enable-feature-flag":"Enable the use of a feature so that users have access to and can use the feature"
  654. "disable-feature-flag":"Disable the use of a feature so that users have access to and can use the feature"
  655. "curl":"Executes a raw request, content-type set to application/json by default"
  656. "config":"write default values to the config"
  657. "oauth-token":"Retrieve and display the OAuth token for the current session"
  658. "add-plugin-repo":"Add a new plugin repository"
  659. "remove-plugin-repo":"Remove a plugin repository"
  660. "list-plugin-repos":"list all the added plugin repository"
  661. "repo-plugins":"List all available plugins in all added repositories"
  662. "plugins":"list all available plugin commands"
  663. "install-plugin":"Install the plugin defined in command argument"
  664. "uninstall-plugin":"Uninstall the plugin defined in command argument"
  665. )
  666. # -----------------------
  667. # ----- end 1st Arguments
  668. # -----------------------
  669. # ----------
  670. # ----- Main
  671. # ----------
  672. _arguments '*:: :->command'
  673. if (( CURRENT == 1 )); then
  674. _describe -t commands "cf command" _1st_arguments
  675. return
  676. fi
  677. local -a _command_args
  678. case "$words[1]" in
  679. login)
  680. __login ;;
  681. logout)
  682. __logout ;;
  683. passwd)
  684. __passwd ;;
  685. target)
  686. __target ;;
  687. api)
  688. __api ;;
  689. auth)
  690. __auth ;;
  691. apps)
  692. __apps ;;
  693. app)
  694. __app ;;
  695. push)
  696. __push ;;
  697. scale)
  698. __scale ;;
  699. delete)
  700. __delete ;;
  701. rename)
  702. __rename ;;
  703. start)
  704. __start ;;
  705. stop)
  706. __stop ;;
  707. restart)
  708. __restart ;;
  709. restage)
  710. __restage ;;
  711. restart-app-instance)
  712. __restart-app-instance ;;
  713. events)
  714. __events ;;
  715. files)
  716. __files ;;
  717. logs)
  718. __logs ;;
  719. env)
  720. __env ;;
  721. set-env)
  722. __set-env ;;
  723. unset-env)
  724. __unset-env ;;
  725. stacks)
  726. __stacks ;;
  727. stack)
  728. __stack ;;
  729. copy-source)
  730. __copy-source ;;
  731. create-app-manifest)
  732. __create-app-manifest ;;
  733. marketplace)
  734. __marketplace ;;
  735. services)
  736. __services ;;
  737. service)
  738. __service ;;
  739. create-service)
  740. __create-service ;;
  741. update-service)
  742. __update-service ;;
  743. rename-service)
  744. __rename-service ;;
  745. delete-service)
  746. __delete-service ;;
  747. create-service-key)
  748. __create-service-key ;;
  749. service-keys)
  750. __service-keys ;;
  751. service-key)
  752. __service-key ;;
  753. delete-service-key)
  754. __delete-service-key ;;
  755. bind-service)
  756. __bind-service ;;
  757. unbind-service)
  758. __unbind-service ;;
  759. create-user-provided-service)
  760. __create-user-provided-service ;;
  761. update-user-provided-service)
  762. __update-user-provided-service ;;
  763. orgs)
  764. __orgs ;;
  765. org)
  766. __org ;;
  767. create-org)
  768. __create-org ;;
  769. delete-org)
  770. __delete-org ;;
  771. spaces)
  772. __spaces ;;
  773. space)
  774. __space ;;
  775. create-space)
  776. __create-space ;;
  777. delete-space)
  778. __delete-space ;;
  779. domains)
  780. __domains ;;
  781. create-domain)
  782. __create-domain ;;
  783. delete-domain)
  784. __delete-domain ;;
  785. create-shared-domain)
  786. __create-shared-domain ;;
  787. delete-shared-domain)
  788. __delete-shared-domain ;;
  789. routes)
  790. __routes ;;
  791. create-route)
  792. __create-route ;;
  793. check-route)
  794. __check-route ;;
  795. map-route)
  796. __map-route ;;
  797. unmap-route)
  798. __unmap-route ;;
  799. delete-route)
  800. __delete-route ;;
  801. delete-orphaned-routes)
  802. __delete-orphaned-routes ;;
  803. buildpacks)
  804. __buildpacks ;;
  805. create-buildpack)
  806. __create-buildpack ;;
  807. update-buildpack)
  808. __update-buildpack ;;
  809. rename-buildpack)
  810. __rename-buildpack ;;
  811. delete-buildpack)
  812. __delete-buildpack ;;
  813. running-environment-variable-group)
  814. __running-environment-variable-group ;;
  815. staging-environment-variable-group)
  816. __staging-environment-variable-group ;;
  817. set-staging-environment-variable-group)
  818. __set-staging-environment-variable-group ;;
  819. set-running-environment-variable-group)
  820. __set-running-environment-variable-group ;;
  821. feature-flags)
  822. __feature-flags ;;
  823. feature-flag)
  824. __feature-flag ;;
  825. enable-feature-flag)
  826. __enable-feature-flag ;;
  827. disable-feature-flag)
  828. __disable-feature-flag ;;
  829. curl)
  830. __curl ;;
  831. config)
  832. __config ;;
  833. oauth-token)
  834. __oauth-token ;;
  835. add-plugin-repo)
  836. __add-plugin-repo ;;
  837. remove-plugin-repo)
  838. __remove-plugin-repo ;;
  839. list-plugin-repos)
  840. __list-plugin-repos ;;
  841. repo-plugins)
  842. __repo-plugins ;;
  843. plugins)
  844. __plugins ;;
  845. install-plugin)
  846. __install-plugin ;;
  847. uninstall-plugin)
  848. __uninstall-plugin ;;
  849. esac