mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Accept "ruby-" version prefix but print a warning to stderr
This commit is contained in:
parent
b974bf54dc
commit
5e52fae7c1
2 changed files with 11 additions and 3 deletions
|
@ -13,10 +13,18 @@ if [ -z "$RBENV_VERSION" ] || [ "$RBENV_VERSION" = "system" ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
RBENV_VERSION_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}"
|
||||
version_exists() {
|
||||
local version="$1"
|
||||
[ -d "${RBENV_ROOT}/versions/${version}" ]
|
||||
}
|
||||
|
||||
if [ -d "$RBENV_VERSION_PATH" ]; then
|
||||
if version_exists "$RBENV_VERSION"; then
|
||||
echo "$RBENV_VERSION"
|
||||
elif version_exists "${RBENV_VERSION#ruby-}"; then
|
||||
{ echo "rbenv: ignoring extraneous \`ruby-' prefix in version \`${RBENV_VERSION}'"
|
||||
echo "(set by $(rbenv-version-origin))"
|
||||
} >&2
|
||||
echo "${RBENV_VERSION#ruby-}"
|
||||
else
|
||||
echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2
|
||||
exit 1
|
||||
|
|
|
@ -21,7 +21,7 @@ fi
|
|||
|
||||
print_version() {
|
||||
if [ "$1" == "$current_version" ]; then
|
||||
echo "${hit_prefix}$(rbenv-version)"
|
||||
echo "${hit_prefix}$(rbenv-version 2>/dev/null)"
|
||||
else
|
||||
echo "${miss_prefix}$1"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue