Last active
August 29, 2015 14:15
-
-
Save un1t/0758ea0d82091d4af12a to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
virtualenv_auto_activate() { | |
GITPATH=`git rev-parse --show-toplevel 2>/dev/null` | |
if [[ "$GITPATH" != "" ]] | |
then | |
if [[ "$VIRTUAL_ENV" == "" ]] | |
then | |
[ -f $GITPATH"/python/bin/activate" ] && source $GITPATH"/python/bin/activate" | |
else | |
[ ! -f $GITPATH"/python/bin/activate" ] && deactivate | |
fi | |
else | |
if [[ "$VIRTUAL_ENV" != "" ]] | |
then | |
deactivate | |
fi | |
fi | |
} | |
PROMPT_COMMAND="virtualenv_auto_activate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment