Block venvs in my home directory
- ID
8c3d27b- date
2024-03-02 08:32:58+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
c7e02a9- message
Block venvs in my home directory- changed files
1 file, 7 additions
Changed files
fish_functions/venv.fish (773) → fish_functions/venv.fish (961)
diff --git a/fish_functions/venv.fish b/fish_functions/venv.fish
index 5d08932..621e542 100644
--- a/fish_functions/venv.fish
+++ b/fish_functions/venv.fish
@@ -7,6 +7,13 @@
# See https://alexwlchan.net/2023/fish-venv/
#
function venv --description "Create and activate a new virtual environment"
+
+ # I don't want venvs in my home directory; block it if I try
+ if test "$PWD" = "$HOME"
+ echo "You can't create a venv in your home directory!" >&2
+ return 1
+ end
+
echo "Creating virtual environment in "(pwd)"/.venv"
python3 -m venv .venv --upgrade-deps
source .venv/bin/activate.fish