From 93426e86eceb39aef788b8395d5d3b17a718bdaa Mon Sep 17 00:00:00 2001 From: Christopher Grim Date: Thu, 5 Dec 2013 00:57:52 -0500 Subject: [PATCH] Complete config names as well as commands Assuming you have a config named myconfig, the following: $ chefvm my[TAB] will complete to: $ chefvm myconfig --- completions/chefvm.bash | 2 +- completions/chefvm.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/completions/chefvm.bash b/completions/chefvm.bash index f04d53a..33f503b 100644 --- a/completions/chefvm.bash +++ b/completions/chefvm.bash @@ -3,7 +3,7 @@ _chefvm() { local word="${COMP_WORDS[COMP_CWORD]}" if [ "$COMP_CWORD" -eq 1 ]; then - COMPREPLY=( $(compgen -W "$(chefvm commands)" -- "$word") ) + COMPREPLY=( $(compgen -W "$(chefvm commands) $(chefvm completions use)" -- "$word") ) else local command="${COMP_WORDS[1]}" local completions="$(chefvm completions "$command")" diff --git a/completions/chefvm.zsh b/completions/chefvm.zsh index 0e34073..cf50d69 100644 --- a/completions/chefvm.zsh +++ b/completions/chefvm.zsh @@ -10,7 +10,7 @@ _chefvm() { word="${words[2]}" if [ "${#words}" -eq 2 ]; then - completions="$(chefvm commands)" + completions="$(chefvm commands) $(chefvm completions use)" else completions="$(chefvm completions "${word}")" fi