diff options
author | Robby Russell <robby@planetargon.com> | 2015-06-14 21:46:41 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2015-06-14 21:46:41 -0700 |
commit | 78bbf7a6e52e7aabc82f22c43c9309a5f0ff1282 (patch) | |
tree | 6a2a6374797c0f303a293cd17547349a617c7404 /plugins/kitchen/_kitchen | |
parent | 9eaf51107f15011f73b39fb727895f65797edcbc (diff) | |
parent | a7e79824f85a89cbcacbceab0277c9833dee4817 (diff) | |
download | zsh-78bbf7a6e52e7aabc82f22c43c9309a5f0ff1282.tar.gz zsh-78bbf7a6e52e7aabc82f22c43c9309a5f0ff1282.tar.bz2 zsh-78bbf7a6e52e7aabc82f22c43c9309a5f0ff1282.zip |
Merge pull request #3809 from ncanceill/easymerge
Easy-to-Merge
Diffstat (limited to 'plugins/kitchen/_kitchen')
-rw-r--r-- | plugins/kitchen/_kitchen | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/kitchen/_kitchen b/plugins/kitchen/_kitchen new file mode 100644 index 000000000..54105b61a --- /dev/null +++ b/plugins/kitchen/_kitchen @@ -0,0 +1,41 @@ +# author: Peter Eisentraut +# source: https://gist.github.com/petere/10307599 +# compdef kitchen + +_kitchen() { + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments '1: :->cmds'\ + '2: :->args' + + case $state in + cmds) + _arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)" + ;; + args) + case $line[1] in + converge|create|destroy|diagnose|list|setup|test|verify) + compadd "$@" all + _kitchen_instances + ;; + login) + _kitchen_instances + ;; + esac + ;; + esac +} + +_kitchen_instances() { + if [[ $_kitchen_instances_cache_dir != $PWD ]]; then + unset _kitchen_instances_cache + fi + if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then + _kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"}) + _kitchen_instances_cache_dir=$PWD + fi + compadd -a _kitchen_instances_cache +} + +_kitchen "$@" |