2011-08-03 22:43:40 -04:00
|
|
|
_rbenv_commands() {
|
2011-08-03 21:44:29 -04:00
|
|
|
COMPREPLY=()
|
2011-08-03 23:20:25 -04:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
COMPREPLY=( $( compgen -W "$(rbenv commands)" -- $cur ) )
|
2011-08-03 21:41:06 -04:00
|
|
|
}
|
|
|
|
|
2011-08-03 22:43:40 -04:00
|
|
|
_rbenv_versions() {
|
2011-08-03 21:44:29 -04:00
|
|
|
COMPREPLY=()
|
2011-08-03 23:22:45 -04:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
local versions="$(echo system; rbenv versions --bare)"
|
2011-08-03 22:43:40 -04:00
|
|
|
COMPREPLY=( $( compgen -W "$versions" -- $cur ) )
|
2011-08-03 21:41:06 -04:00
|
|
|
}
|
|
|
|
|
2011-08-03 21:44:29 -04:00
|
|
|
_rbenv() {
|
|
|
|
COMPREPLY=()
|
2011-08-03 23:28:30 -04:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
2011-08-03 21:41:06 -04:00
|
|
|
|
2011-08-03 23:28:30 -04:00
|
|
|
case "$prev" in
|
2011-09-07 11:26:11 -04:00
|
|
|
set-* | global | local | shell | prefix )
|
2011-08-03 22:43:40 -04:00
|
|
|
_rbenv_versions
|
2011-08-03 23:28:30 -04:00
|
|
|
;;
|
|
|
|
* )
|
2011-08-03 22:43:40 -04:00
|
|
|
_rbenv_commands
|
2011-08-03 23:28:30 -04:00
|
|
|
;;
|
|
|
|
esac
|
2011-08-03 21:41:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _rbenv rbenv
|