diff options
author | Sean Escriva <sean.escriva@gmail.com> | 2014-05-24 14:24:56 -0400 |
---|---|---|
committer | ncanceill <nicolas.canceill@ens-cachan.org> | 2015-06-10 14:36:55 +0200 |
commit | f21a672fed1e1455c8341c972f3ba5a408726053 (patch) | |
tree | add717ef7008353fe24a52dd2f6a91b660b743de /plugins/kitchen | |
parent | 70c4a27fd6048c3213dd2f3bae21bff26005bc16 (diff) | |
download | zsh-f21a672fed1e1455c8341c972f3ba5a408726053.tar.gz zsh-f21a672fed1e1455c8341c972f3ba5a408726053.tar.bz2 zsh-f21a672fed1e1455c8341c972f3ba5a408726053.zip |
add kitchen completion plugin from @petere
Diffstat (limited to 'plugins/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 "$@" |