From 7b4b51a79eaca4cd6199c8da0e10d8961f2ac0e0 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Mon, 12 Sep 2011 20:38:48 -0500 Subject: [PATCH] Show usage --- bin/rbenv-install | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/rbenv-install b/bin/rbenv-install index 47af0ff4..3dca6489 100755 --- a/bin/rbenv-install +++ b/bin/rbenv-install @@ -6,4 +6,21 @@ if [ -z "$RBENV_ROOT" ]; then RBENV_ROOT="${HOME}/.rbenv" fi -exec ruby-build "$1" "${RBENV_ROOT}/versions/$1" +DEFINITION="$1" +case "$DEFINITION" in +"" | -* ) + { echo "usage: rbenv install VERSION" + echo " rbenv install /path/to/definition" + echo + echo "Available versions:" + ruby-build --definitions | sed 's/^/ /' + echo + } >&2 + exit 1 + ;; +esac + +VERSION_NAME="${DEFINITION##*/}" +PREFIX="${RBENV_ROOT}/versions/${VERSION_NAME}" + +exec ruby-build "$DEFINITION" "$PREFIX"