pyenv/completions/rbenv.bash

34 lines
677 B
Bash
Raw Normal View History

2011-08-03 22:43:40 -04:00
_rbenv_commands() {
2011-08-03 21:44:29 -04:00
local cur commands
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
commands="exec prefix rehash set-default set-local version versions\
whence which"
2011-08-03 21:44:29 -04:00
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
}
2011-08-03 22:43:40 -04:00
_rbenv_versions() {
2011-08-03 21:44:29 -04:00
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local versions=(system $(rbenv versions --bare))
versions="${versions[@]}"
2011-08-03 22:43:40 -04:00
COMPREPLY=( $( compgen -W "$versions" -- $cur ) )
}
2011-08-03 21:44:29 -04:00
_rbenv() {
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
2011-08-03 21:44:29 -04:00
if [ "$prev" = "set-default" ]; then
2011-08-03 22:43:40 -04:00
_rbenv_versions
2011-08-03 21:44:29 -04:00
else
2011-08-03 22:43:40 -04:00
_rbenv_commands
2011-08-03 21:44:29 -04:00
fi
}
complete -F _rbenv rbenv