From df034f5d354d0bab5e70294c1d8694bb3f4da6da Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 3 Aug 2011 21:50:03 -0500 Subject: [PATCH] Defer to `rbenv versions` instead of reading ~/.rbenv/versions manually --- completions/rbenv.bash | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/completions/rbenv.bash b/completions/rbenv.bash index 438f5f14..de53fc69 100644 --- a/completions/rbenv.bash +++ b/completions/rbenv.bash @@ -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 ) ) }