Skip to content

Commit 7b4b51a

Browse files
committed
Show usage
1 parent a72a81b commit 7b4b51a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

bin/rbenv-install

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@ if [ -z "$RBENV_ROOT" ]; then
66
RBENV_ROOT="${HOME}/.rbenv"
77
fi
88

9-
exec ruby-build "$1" "${RBENV_ROOT}/versions/$1"
9+
DEFINITION="$1"
10+
case "$DEFINITION" in
11+
"" | -* )
12+
{ echo "usage: rbenv install VERSION"
13+
echo " rbenv install /path/to/definition"
14+
echo
15+
echo "Available versions:"
16+
ruby-build --definitions | sed 's/^/ /'
17+
echo
18+
} >&2
19+
exit 1
20+
;;
21+
esac
22+
23+
VERSION_NAME="${DEFINITION##*/}"
24+
PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}"
25+
26+
exec ruby-build "$DEFINITION" "$PREFIX"

0 commit comments

Comments
 (0)