libexec/rbenv-version{,-origin}: fix earlier commit to allow for RBENV_VERSION env var

This commit is contained in:
Jeffrey 'jf' Lim 2020-01-08 16:40:48 +08:00
parent dd86f543fc
commit 5c3268c9af
2 changed files with 8 additions and 5 deletions

View file

@ -8,9 +8,9 @@
set -e set -e
[ -n "$RBENV_DEBUG" ] && set -x [ -n "$RBENV_DEBUG" ] && set -x
RBENV_VERSION_FILE="$(rbenv-version-origin)" RBENV_VERSION_ORIGIN="$(rbenv-version-origin)"
if [ -e "$RBENV_VERSION_FILE" ]; then if [ -z "$RBENV_VERSION_ORIGIN" ]; then
echo "$(rbenv-version-name) (set by $RBENV_VERSION_FILE)"
else
echo "$(rbenv-version-name)" echo "$(rbenv-version-name)"
else
echo "$(rbenv-version-name) (set by $RBENV_VERSION_ORIGIN)"
fi fi

View file

@ -17,5 +17,8 @@ if [ -n "$RBENV_VERSION_ORIGIN" ]; then
elif [ -n "$RBENV_VERSION" ]; then elif [ -n "$RBENV_VERSION" ]; then
echo "RBENV_VERSION environment variable" echo "RBENV_VERSION environment variable"
else else
rbenv-version-file RBENV_VERSION_FILE="$(rbenv-version-file)"
if [ -e "$RBENV_VERSION_FILE" ]; then
echo $RBENV_VERSION_FILE
fi
fi fi