mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-18 00:13:43 -05:00
activate: invoke pyenv shell only if the arguments passed
This commit is contained in:
@@ -26,9 +26,8 @@ if [ "$1" = "--unset" ]; then
|
||||
fi
|
||||
|
||||
versions=("$@")
|
||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
|
||||
if [ -z "$versions" ]; then
|
||||
no_shell=1
|
||||
OLDIFS="$IFS"
|
||||
IFS=: versions=($(pyenv-version-name))
|
||||
IFS="$OLDIFS"
|
||||
@@ -41,7 +40,11 @@ fi
|
||||
|
||||
pyenv-virtualenv-prefix "${versions}" 1>/dev/null
|
||||
|
||||
echo "pyenv shell \"${versions}\";"
|
||||
if [ -z "$no_shell" ]; then
|
||||
echo "pyenv shell \"${versions}\";"
|
||||
fi
|
||||
|
||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
case "$shell" in
|
||||
fish ) echo ". \"$(pyenv-prefix "${versions}")/bin/activate.fish\"" ;;
|
||||
* ) echo "source \"$(pyenv-prefix "${versions}")/bin/activate\"" ;;
|
||||
|
||||
@@ -11,7 +11,6 @@ set -e
|
||||
|
||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
case "$shell" in
|
||||
fish ) echo "functions -q deactivate; and deactivate;";;
|
||||
* ) echo "declare -f deactivate 1>/dev/null 2>&1 && deactivate;";;
|
||||
fish ) echo "functions -q deactivate; and deactivate";;
|
||||
* ) echo "declare -f deactivate 1>/dev/null 2>&1 && deactivate";;
|
||||
esac
|
||||
echo "pyenv shell --unset"
|
||||
|
||||
Reference in New Issue
Block a user