Defer to rbenv versions instead of reading ~/.rbenv/versions manually

This commit is contained in:
Sam Stephenson 2011-08-03 21:50:03 -05:00
parent f7c463bed9
commit df034f5d35

View file

@ -9,13 +9,10 @@ _rbenv_commands() {
}
_rbenv_versions() {
local cur versions
local ROOT="${HOME}/.rbenv/versions"
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
versions=($ROOT/*)
# remove all but the final part of the name
versions="${versions[@]##*/}"
local cur=${COMP_WORDS[COMP_CWORD]}
local versions=(system $(rbenv versions --bare))
versions="${versions[@]}"
COMPREPLY=( $( compgen -W "$versions" -- $cur ) )
}