mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Make rbenv-sh-shell consistent with rbenv-local
This commit is contained in:
parent
5ad45afe5e
commit
76929320c8
1 changed files with 19 additions and 18 deletions
|
@ -1,23 +1,24 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please specify one of the following Ruby versions to use:" >&2
|
||||
echo "" >&2
|
||||
echo "$(rbenv-versions)" >&2
|
||||
version="$1"
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
if [ -z "$RBENV_VERSION" ]; then
|
||||
echo "rbenv: no shell-specific version configured" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "echo \"\$RBENV_VERSION\""
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$version" = "--unset" ]; then
|
||||
echo "unset RBENV_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
# Make sure the specified version is installed.
|
||||
rbenv-prefix "$version" >/dev/null
|
||||
|
||||
if [ -d "$HOME/.rbenv/versions/$version" ]; then
|
||||
echo "export RBENV_VERSION=$version"
|
||||
else
|
||||
case $version in
|
||||
default)
|
||||
echo "unset RBENV_VERSION"
|
||||
;;
|
||||
*)
|
||||
echo "rbenv: version \`$version' is not installed" >&2
|
||||
exit 1
|
||||
esac
|
||||
fi
|
||||
echo "export RBENV_VERSION=\"${version}\""
|
||||
|
|
Loading…
Reference in a new issue