Don't create venv and .envrc if .envrc already exists.
This is to avoid duplicate PATH in .envrcs.
This commit is contained in:
parent
faee2d9da8
commit
799ab218ad
8
.bashrc
8
.bashrc
|
@ -178,8 +178,14 @@ venv()
|
|||
# direnv-enabled venv creation.
|
||||
if ! [[ -d .venv ]]
|
||||
then
|
||||
if [[ -f .envrc ]]
|
||||
then
|
||||
echo '`.venv` does not exists but `.envrc` file already exists!'
|
||||
echo "Human? Untangle it, please."
|
||||
return
|
||||
fi
|
||||
"python$1" -m venv .venv
|
||||
echo 'PATH=$(pwd)/.venv/bin/:$PATH' >> .envrc
|
||||
echo 'PATH=$(pwd)/.venv/bin/:$PATH' > .envrc
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue