| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
function deactivate -d "Exit virtual environment and return to normal shell environment" |
| 5 |
|
| 6 |
if test -n "$_OLD_VIRTUAL_PATH" |
| 7 |
set -gx PATH $_OLD_VIRTUAL_PATH |
| 8 |
set -e _OLD_VIRTUAL_PATH |
| 9 |
end |
| 10 |
if test -n "$_OLD_VIRTUAL_PYTHONHOME" |
| 11 |
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME |
| 12 |
set -e _OLD_VIRTUAL_PYTHONHOME |
| 13 |
end |
| 14 |
|
| 15 |
if test -n "$_OLD_FISH_PROMPT_OVERRIDE" |
| 16 |
set -e _OLD_FISH_PROMPT_OVERRIDE |
| 17 |
|
| 18 |
if functions -q _old_fish_prompt |
| 19 |
functions -e fish_prompt |
| 20 |
functions -c _old_fish_prompt fish_prompt |
| 21 |
functions -e _old_fish_prompt |
| 22 |
end |
| 23 |
end |
| 24 |
|
| 25 |
set -e VIRTUAL_ENV |
| 26 |
set -e VIRTUAL_ENV_PROMPT |
| 27 |
if test "$argv[1]" != "nondestructive" |
| 28 |
|
| 29 |
functions -e deactivate |
| 30 |
end |
| 31 |
end |
| 32 |
|
| 33 |
|
| 34 |
deactivate nondestructive |
| 35 |
|
| 36 |
set -gx VIRTUAL_ENV __VENV_DIR__ |
| 37 |
|
| 38 |
set -gx _OLD_VIRTUAL_PATH $PATH |
| 39 |
set -gx PATH "$VIRTUAL_ENV/"__VENV_BIN_NAME__ $PATH |
| 40 |
|
| 41 |
|
| 42 |
if set -q PYTHONHOME |
| 43 |
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME |
| 44 |
set -e PYTHONHOME |
| 45 |
end |
| 46 |
|
| 47 |
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
functions -c fish_prompt _old_fish_prompt |
| 52 |
|
| 53 |
|
| 54 |
function fish_prompt |
| 55 |
|
| 56 |
set -l old_status $status |
| 57 |
|
| 58 |
|
| 59 |
printf "%s%s%s" (set_color 4B8BBE) __VENV_PROMPT__ (set_color normal) |
| 60 |
|
| 61 |
|
| 62 |
echo "exit $old_status" | . |
| 63 |
|
| 64 |
_old_fish_prompt |
| 65 |
end |
| 66 |
|
| 67 |
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" |
| 68 |
set -gx VIRTUAL_ENV_PROMPT __VENV_PROMPT__ |
| 69 |
end |