summaryrefslogtreecommitdiff
path: root/venv/bin/activate.fish
diff options
context:
space:
mode:
Diffstat (limited to 'venv/bin/activate.fish')
-rw-r--r--venv/bin/activate.fish75
1 files changed, 75 insertions, 0 deletions
diff --git a/venv/bin/activate.fish b/venv/bin/activate.fish
new file mode 100644
index 0000000..df64168
--- /dev/null
+++ b/venv/bin/activate.fish
@@ -0,0 +1,75 @@
1# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
2# you cannot run it directly
3
4function 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
27end
28
29# unset irrelevant variables
30deactivate nondestructive
31
32set -gx VIRTUAL_ENV "/home/a9o9/PycharmProjects/network_scanner/venv"
33
34set -gx _OLD_VIRTUAL_PATH $PATH
35set -gx PATH "$VIRTUAL_ENV/bin" $PATH
36
37# unset PYTHONHOME if set
38if set -q PYTHONHOME
39 set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
40 set -e PYTHONHOME
41end
42
43if 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 "(venv) "
56 printf "%s%s" "(venv) " (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"
75end