Last active
April 19, 2016 16:17
-
-
Save romuald/f31f301e03660b04b6ba5b438df72f43 to your computer and use it in GitHub Desktop.
Activate a virtualenv for current directory
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
# zsh <3 | |
vba() { | |
local venv | |
local base="." | |
while :; do | |
venv=($base/venv*/bin/activate(N)) | |
if [ $#venv = 1 ]; then | |
source $venv | |
return 0 | |
fi | |
if [ $(readlink -f $base) = "/" ]; then | |
return 1 | |
fi | |
base="$base/.." | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment