aboutsummaryrefslogtreecommitdiffstats
path: root/src/_cf
diff options
context:
space:
mode:
authordannyzen <danny.rosen@gmail.com>2017-05-16 12:00:45 -0400
committerdannyzen <danny.rosen@gmail.com>2017-05-16 12:00:45 -0400
commitf02423840c8fe3dbb20b7ee46df51cbfa51bbcad (patch)
tree46a4618deb8012287f420fd3fdc47bd9a9f963ca /src/_cf
parentMerge pull request #506 from knu/sed_-E (diff)
downloadzsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar.gz
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar.bz2
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar.lz
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar.xz
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.tar.zst
zsh-completions-f02423840c8fe3dbb20b7ee46df51cbfa51bbcad.zip
adding additional features to cloudfoundry cli
Diffstat (limited to 'src/_cf')
-rw-r--r--src/_cf47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/_cf b/src/_cf
index 344dae8..4649c2b 100644
--- a/src/_cf
+++ b/src/_cf
@@ -1,7 +1,7 @@
#compdef cf
# ------------------------------------------------------------------------------
#
-# Copyright 2015 Ferran Rodenas & Danny Rosen
+# Copyright 2015 Ferran Rodenas
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
# -------
#
# * Ferran Rodenas (https://github.com/frodenas)
-# * Danny Rosen (https://github.com/dannyzen)
#
# ------------------------------------------------------------------------------
@@ -140,6 +139,15 @@ __cf_plugins() {
_describe 'PLUGIN' cont_cmd
}
+# Output a selectable list of targets (requires cf-targets plugin)
+__cf_targets() {
+ declare -a cont_cmd
+ cont_cmd=($(cf targets | awk '{print $1}'))
+ if [[ 'X$cont_cmd' != 'X' ]]
+ _describe 'TARGET' cont_cmd
+}
+
+
# --------------------------
# ----- end Helper functions
# --------------------------
@@ -153,8 +161,8 @@ __login() {
'-a=[API endpoint (e.g. https://api.example.com)]:api endpoint:' \
'-u=[Username]:username:' \
'-p=[Password]:password:' \
- '-o=[Organization]:organization name:' \
- '-s=[Space]:space name:' \
+ '-o=[Organization]:organization name:__cf_orgs' \
+ '-s=[Space]:space name:__cf_spaces' \
'--sso[Use a one-time password to login]' \
'--skip-ssl-validation[Skip SSL validation]'
}
@@ -197,8 +205,8 @@ __app() {
__push() {
_arguments \
- '1:application name:' \
- '-b=[Custom buildpack by name (e.g. my-buildpack) or GIT URL or GIT BRANCH URL]' \
+ '1:application name:__cf_apps' \
+ '-b=[Custom buildpack by name (e.g. my-buildpack) or GIT URL or GIT BRANCH URL]:buildpack name:__cf_buildpacks' \
'-c=[Startup command, set to null to reset to default start command]:startup command:' \
'-d=[Domain (e.g. example.com)]:domain (e.g. example.com):__cf_domains' \
'-f=[Path to manifest]:file:_files:' \
@@ -669,6 +677,23 @@ __uninstall-plugin() {
'1:plugin name:__cf_plugins'
}
+__save-target() {
+ _arguments \
+ '1:target-name:' \
+ '-f[Force save even if current target is already saved under another name]'
+}
+
+__set-target() {
+ _arguments \
+ '1:target-name:__cf_targets' \
+ '-f[Force target change even if current target is unsaved]'
+}
+
+__delete-target() {
+ _arguments \
+ '1:target-name:__cf_targets'
+}
+
# ------------------
# ----- end Commands
# ------------------
@@ -766,6 +791,10 @@ _1st_arguments=(
"plugins":"list all available plugin commands"
"install-plugin":"Install the plugin defined in command argument"
"uninstall-plugin":"Uninstall the plugin defined in command argument"
+ "targets":"List all saved targets (requires cf-targets plugin)"
+ "save-target":"Save the current target under a given name (requires cf-targets plugin)"
+ "set-target":"Restore a previously saved target (requires cf-targets plugin)"
+ "delete-target":"Delete a saved target (requires cf-targets plugin)"
)
# -----------------------
@@ -955,4 +984,10 @@ case "$words[1]" in
__install-plugin ;;
uninstall-plugin)
__uninstall-plugin ;;
+ save-target)
+ __save-target ;;
+ set-target)
+ __set-target ;;
+ delete-target)
+ __delete-target ;;
esac