activate.fish 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # This file must be used with "source <venv>/bin/activate.fish" *from fish*
  2. # (https://fishshell.com/); you cannot run it directly.
  3. function deactivate -d "Exit virtual environment 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. set -e VIRTUAL_ENV_PROMPT
  21. if test "$argv[1]" != "nondestructive"
  22. # Self-destruct!
  23. functions -e deactivate
  24. end
  25. end
  26. # Unset irrelevant variables.
  27. deactivate nondestructive
  28. set -gx VIRTUAL_ENV "/home/ubuntu-test/Desktop/proj2/backend_dev/Market_Place_NFT/my_env"
  29. set -gx _OLD_VIRTUAL_PATH $PATH
  30. set -gx PATH "$VIRTUAL_ENV/bin" $PATH
  31. # Unset PYTHONHOME if set.
  32. if set -q PYTHONHOME
  33. set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
  34. set -e PYTHONHOME
  35. end
  36. if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
  37. # fish uses a function instead of an env var to generate the prompt.
  38. # Save the current fish_prompt function as the function _old_fish_prompt.
  39. functions -c fish_prompt _old_fish_prompt
  40. # With the original prompt function renamed, we can override with our own.
  41. function fish_prompt
  42. # Save the return status of the last command.
  43. set -l old_status $status
  44. # Output the venv prompt; color taken from the blue of the Python logo.
  45. printf "%s%s%s" (set_color 4B8BBE) "(my_env) " (set_color normal)
  46. # Restore the return status of the previous command.
  47. echo "exit $old_status" | .
  48. # Output the original/"old" prompt.
  49. _old_fish_prompt
  50. end
  51. set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
  52. set -gx VIRTUAL_ENV_PROMPT "(my_env) "
  53. end