Created
April 11, 2024 04:13
-
-
Save obar1/212e4c778548f8bcdc6e9c1b05856f3f to your computer and use it in GitHub Desktop.
venv auto cd handling for 0to100 folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function venv_cd() { | |
# set -x | |
if [[ $PWD == */0to100* ]]; then | |
echo "0to100 folder..." | |
if [[ -d .venv ]]; then | |
if [[ "$VIRTUAL_ENV" == "$PWD/.venv" ]]; then | |
echo "using $VIRTUAL_ENV" | |
else | |
deactivate || true | |
source .venv/bin/activate | |
echo "new $VIRTUAL_ENV..." | |
fi | |
fi | |
fi | |
# set +x | |
} | |
PROMPT_COMMAND=venv_cd |
Author
obar1
commented
Apr 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment