Added bash support for completion of full command line

This commit is contained in:
Brian Olsen 2012-10-05 04:28:25 +02:00
parent 6778c8e905
commit 02332d78f3

View file

@ -5,8 +5,10 @@ _rbenv() {
if [ "$COMP_CWORD" -eq 1 ]; then
COMPREPLY=( $(compgen -W "$(rbenv commands)" -- "$word") )
else
local command="${COMP_WORDS[1]}"
local completions="$(rbenv completions "$command")"
local words=("${COMP_WORDS[@]}")
unset words[0]
unset words[$COMP_CWORD]
local completions=$(rbenv completions "${words[@]}")
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
fi
}