Display information on automatic (de)?activation

This commit is contained in:
Yamashita Yuu
2014-07-04 22:26:55 +09:00
parent 58ed045796
commit d4ce853e94
6 changed files with 129 additions and 55 deletions

View File

@@ -77,16 +77,16 @@ fish )
function _pyenv_virtualenv_hook --on-event fish_prompt;
if [ -n "\$VIRTUAL_ENV" ]
if [ (pyenv version-name) = "system" ]
eval (pyenv sh-deactivate); or true
eval (pyenv sh-deactivate --no-error --verbose)
return 0
end
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
eval (pyenv sh-deactivate); or true
eval (pyenv sh-activate 2>/dev/null); or true
eval (pyenv sh-deactivate --no-error --verbose)
eval (pyenv sh-activate --no-error --verbose)
end
else
if [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
eval (pyenv sh-activate 2>/dev/null); or true
eval (pyenv sh-activate --no-error --verbose)
end
end
end
@@ -108,16 +108,16 @@ if [[ "$shell" != "fish" ]]; then
cat <<EOS
if [ -n "\$VIRTUAL_ENV" ]; then
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
pyenv deactivate || true
pyenv deactivate --no-error --verbose
return 0
fi
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
pyenv deactivate || true
pyenv activate 2>/dev/null || true
pyenv deactivate --no-error --verbose
pyenv activate --no-error --verbose
fi
else
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
pyenv activate 2>/dev/null || true
pyenv activate --no-error --verbose
fi
fi
};