Created
August 2, 2019 21:05
-
-
Save ckabalan/ece142637c6394a1acfa1cb7d7ae0c3d to your computer and use it in GitHub Desktop.
ZSH Activate/Deactive Virtual Environment
This file contains hidden or 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
venv () { | |
if ((${+VIRTUAL_ENV})); then | |
echo "Deactivating Virtual Environment: $VIRTUAL_ENV" | |
deactivate | |
else | |
VENV_PATH=${PWD:gs/\/home\/ckabalan\//\/home\/ckabalan\/.virtualenv\//} | |
ACTIVATE_PATH=$VENV_PATH/bin/activate | |
if [[ -e $ACTIVATE_PATH ]]; then | |
echo "Activating Virtual Environment: $VENV_PATH" | |
source $ACTIVATE_PATH | |
else | |
echo "Virtual Environment Does Not Exist At: $VENV_PATH" | |
fi | |
fi | |
unset REL_PATH | |
unset VENV_PATH | |
unset ACTIVATE_PATH | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment