Skip to content

Instantly share code, notes, and snippets.

@ckabalan
Created August 2, 2019 21:05
Show Gist options
  • Save ckabalan/ece142637c6394a1acfa1cb7d7ae0c3d to your computer and use it in GitHub Desktop.
Save ckabalan/ece142637c6394a1acfa1cb7d7ae0c3d to your computer and use it in GitHub Desktop.
ZSH Activate/Deactive Virtual Environment
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