diff --git a/libexec/rbenv-sh-shell b/libexec/rbenv-sh-shell index 04f81866..8c71185c 100755 --- a/libexec/rbenv-sh-shell +++ b/libexec/rbenv-sh-shell @@ -45,11 +45,11 @@ fi if [ "$version" = "--unset" ]; then case "$shell" in fish ) - echo 'set -gu OLD_RBENV_VERSION "$RBENV_VERSION"' + echo 'set -gu RBENV_VERSION_OLD "$RBENV_VERSION"' echo "set -e RBENV_VERSION" ;; * ) - echo 'OLD_RBENV_VERSION="$RBENV_VERSION"' + echo 'RBENV_VERSION_OLD="$RBENV_VERSION"' echo "unset RBENV_VERSION" ;; esac @@ -60,36 +60,36 @@ if [ "$version" = "-" ]; then case "$shell" in fish ) cat <&2 + echo "rbenv: RBENV_VERSION_OLD is not set" >&2 false end EOS ;; * ) cat <&2 + echo "rbenv: RBENV_VERSION_OLD is not set" >&2 false fi EOS @@ -103,11 +103,11 @@ if rbenv-prefix "$version" >/dev/null; then if [ "$version" != "$RBENV_VERSION" ]; then case "$shell" in fish ) - echo 'set -gu OLD_RBENV_VERSION "$RBENV_VERSION"' + echo 'set -gu RBENV_VERSION_OLD "$RBENV_VERSION"' echo "set -gx RBENV_VERSION \"$version\"" ;; * ) - echo 'OLD_RBENV_VERSION="$RBENV_VERSION"' + echo 'RBENV_VERSION_OLD="$RBENV_VERSION"' echo "export RBENV_VERSION=\"$version\"" ;; esac diff --git a/test/shell.bats b/test/shell.bats index a3c16b66..9d6ae14b 100644 --- a/test/shell.bats +++ b/test/shell.bats @@ -23,20 +23,20 @@ load test_helper @test "shell revert" { RBENV_SHELL=bash run rbenv-sh-shell - assert_success - assert_line 0 'if [ -n "${OLD_RBENV_VERSION+x}" ]; then' + assert_line 0 'if [ -n "${RBENV_VERSION_OLD+x}" ]; then' } @test "shell revert (fish)" { RBENV_SHELL=fish run rbenv-sh-shell - assert_success - assert_line 0 'if set -q OLD_RBENV_VERSION' + assert_line 0 'if set -q RBENV_VERSION_OLD' } @test "shell unset" { RBENV_SHELL=bash run rbenv-sh-shell --unset assert_success assert_output <