2011-08-04 02:43:40 +00:00
|
|
|
_rbenv_commands() {
|
2011-08-04 01:44:29 +00:00
|
|
|
COMPREPLY=()
|
2011-08-04 03:20:25 +00:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
COMPREPLY=( $( compgen -W "$(rbenv commands)" -- $cur ) )
|
2011-08-04 01:41:06 +00:00
|
|
|
}
|
|
|
|
|
2011-08-04 02:43:40 +00:00
|
|
|
_rbenv_versions() {
|
2011-08-04 01:44:29 +00:00
|
|
|
COMPREPLY=()
|
2011-08-04 03:22:45 +00:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
local versions="$(echo system; rbenv versions --bare)"
|
2011-08-04 02:43:40 +00:00
|
|
|
COMPREPLY=( $( compgen -W "$versions" -- $cur ) )
|
2011-08-04 01:41:06 +00:00
|
|
|
}
|
|
|
|
|
2011-08-04 01:44:29 +00:00
|
|
|
_rbenv() {
|
|
|
|
COMPREPLY=()
|
2011-08-04 03:28:30 +00:00
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
2011-08-04 01:41:06 +00:00
|
|
|
|
2011-08-04 03:28:30 +00:00
|
|
|
case "$prev" in
|
2011-08-13 06:34:15 +00:00
|
|
|
default | local | prefix )
|
2011-08-04 02:43:40 +00:00
|
|
|
_rbenv_versions
|
2011-08-04 03:28:30 +00:00
|
|
|
;;
|
|
|
|
* )
|
2011-08-04 02:43:40 +00:00
|
|
|
_rbenv_commands
|
2011-08-04 03:28:30 +00:00
|
|
|
;;
|
|
|
|
esac
|
2011-08-04 01:41:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _rbenv rbenv
|