Skip to content

Commit

Permalink
Add known rubies completion for install subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
sj26 authored and wayneeseguin committed Sep 3, 2010
1 parent 86dca89 commit 1344005
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/completion
Expand Up @@ -33,6 +33,15 @@ __rvm_gemsets ()
echo "$(rvm gemset list | \grep -v gemset 2>/dev/null)"
}

__rvm_known ()
{
# Strips comments and expands known patterns into each variation
rvm list known | sed 's/#.*$//' | sed '
s/^(\([^)]*\))\(.*\)(\([^)]*\))$/\1\2\3 \1\2 \2\3 \2/
s/^(\([^)]*\))\(.*\)$/\1\2 \2/
s/^\(.*\)(\([^)]*\))$/\1\2 \1/'
}

_rvm_commands ()
{
local cur=${COMP_WORDS[COMP_CWORD]}
Expand Down Expand Up @@ -105,13 +114,19 @@ _rvm_gemset ()
fi
}

_rvm_install ()
{
__rvm_comp "$(__rvm_known)"
}

_rvm ()
{
local prev=${COMP_WORDS[COMP_CWORD-1]}

case "${prev}" in
use) _rvm_use ;;
gemset) _rvm_gemset ;;
install) _rvm_install ;;
*) _rvm_commands ;;
esac

Expand Down

0 comments on commit 1344005

Please sign in to comment.