comparison planemo/bin/activate.fish @ 0:d30785e31577 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:18:57 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d30785e31577
1 # This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
2 # you cannot run it directly
3
4 function deactivate -d "Exit virtualenv and return to normal shell environment"
5 # reset old environment variables
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 functions -e fish_prompt
17 set -e _OLD_FISH_PROMPT_OVERRIDE
18 functions -c _old_fish_prompt fish_prompt
19 functions -e _old_fish_prompt
20 end
21
22 set -e VIRTUAL_ENV
23 if test "$argv[1]" != "nondestructive"
24 # Self destruct!
25 functions -e deactivate
26 end
27 end
28
29 # unset irrelevant variables
30 deactivate nondestructive
31
32 set -gx VIRTUAL_ENV "/Users/guerler/spring/springsuite/planemo"
33
34 set -gx _OLD_VIRTUAL_PATH $PATH
35 set -gx PATH "$VIRTUAL_ENV/bin" $PATH
36
37 # unset PYTHONHOME if set
38 if set -q PYTHONHOME
39 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
40 set -e PYTHONHOME
41 end
42
43 if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
44 # fish uses a function instead of an env var to generate the prompt.
45
46 # save the current fish_prompt function as the function _old_fish_prompt
47 functions -c fish_prompt _old_fish_prompt
48
49 # with the original prompt function renamed, we can override with our own.
50 function fish_prompt
51 # Save the return status of the last command
52 set -l old_status $status
53
54 # Prompt override?
55 if test -n "(planemo) "
56 printf "%s%s" "(planemo) " (set_color normal)
57 else
58 # ...Otherwise, prepend env
59 set -l _checkbase (basename "$VIRTUAL_ENV")
60 if test $_checkbase = "__"
61 # special case for Aspen magic directories
62 # see http://www.zetadev.com/software/aspen/
63 printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
64 else
65 printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
66 end
67 end
68
69 # Restore the return status of the previous command.
70 echo "exit $old_status" | .
71 _old_fish_prompt
72 end
73
74 set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
75 end