Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

activate.fish 2.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  1. # This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
  2. # you cannot run it directly
  3. function deactivate -d "Exit virtualenv and return to normal shell environment"
  4. # reset old environment variables
  5. if test -n "$_OLD_VIRTUAL_PATH"
  6. set -gx PATH $_OLD_VIRTUAL_PATH
  7. set -e _OLD_VIRTUAL_PATH
  8. end
  9. if test -n "$_OLD_VIRTUAL_PYTHONHOME"
  10. set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
  11. set -e _OLD_VIRTUAL_PYTHONHOME
  12. end
  13. if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
  14. functions -e fish_prompt
  15. set -e _OLD_FISH_PROMPT_OVERRIDE
  16. functions -c _old_fish_prompt fish_prompt
  17. functions -e _old_fish_prompt
  18. end
  19. set -e VIRTUAL_ENV
  20. if test "$argv[1]" != "nondestructive"
  21. # Self destruct!
  22. functions -e deactivate
  23. end
  24. end
  25. # unset irrelevant variables
  26. deactivate nondestructive
  27. set -gx VIRTUAL_ENV "/Users/daniellagrimberg/itc/first-repo/env"
  28. set -gx _OLD_VIRTUAL_PATH $PATH
  29. set -gx PATH "$VIRTUAL_ENV/bin" $PATH
  30. # unset PYTHONHOME if set
  31. if set -q PYTHONHOME
  32. set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
  33. set -e PYTHONHOME
  34. end
  35. if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
  36. # fish uses a function instead of an env var to generate the prompt.
  37. # save the current fish_prompt function as the function _old_fish_prompt
  38. functions -c fish_prompt _old_fish_prompt
  39. # with the original prompt function renamed, we can override with our own.
  40. function fish_prompt
  41. # Save the return status of the last command
  42. set -l old_status $status
  43. # Prompt override?
  44. if test -n "(env) "
  45. printf "%s%s" "(env) " (set_color normal)
  46. else
  47. # ...Otherwise, prepend env
  48. set -l _checkbase (basename "$VIRTUAL_ENV")
  49. if test $_checkbase = "__"
  50. # special case for Aspen magic directories
  51. # see http://www.zetadev.com/software/aspen/
  52. printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
  53. else
  54. printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
  55. end
  56. end
  57. # Restore the return status of the previous command.
  58. echo "exit $old_status" | .
  59. _old_fish_prompt
  60. end
  61. set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
  62. end
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...