Skip to content

Instantly share code, notes, and snippets.

@romuald
Last active April 19, 2016 16:17
Show Gist options
  • Save romuald/f31f301e03660b04b6ba5b438df72f43 to your computer and use it in GitHub Desktop.
Save romuald/f31f301e03660b04b6ba5b438df72f43 to your computer and use it in GitHub Desktop.
Activate a virtualenv for current directory
# 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