You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

activate.fish 2.4KB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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/khaloufam70043/Desktop/Web Engineering Prk/Socket/venv"
  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 "(venv) "
  45. printf "%s%s" "(venv) " (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