pyenv/completions/rbenv.bash

28 lines
559 B
Bash
Raw Normal View History

2011-08-03 21:43:40 -05:00
_rbenv_commands() {
2011-08-03 20:44:29 -05:00
COMPREPLY=()
2011-08-03 22:20:25 -05:00
local cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $( compgen -W "$(rbenv commands)" -- $cur ) )
}
2011-08-03 21:43:40 -05:00
_rbenv_versions() {
2011-08-03 20:44:29 -05:00
COMPREPLY=()
2011-08-03 22:22:45 -05:00
local cur="${COMP_WORDS[COMP_CWORD]}"
local versions="$(echo system; rbenv versions --bare)"
2011-08-03 21:43:40 -05:00
COMPREPLY=( $( compgen -W "$versions" -- $cur ) )
}
2011-08-03 20:44:29 -05:00
_rbenv() {
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
2011-08-03 20:44:29 -05:00
if [ "$prev" = "set-default" ]; then
2011-08-03 21:43:40 -05:00
_rbenv_versions
2011-08-03 20:44:29 -05:00
else
2011-08-03 21:43:40 -05:00
_rbenv_commands
2011-08-03 20:44:29 -05:00
fi
}
complete -F _rbenv rbenv