-
-
Save davesque/3954372 to your computer and use it in GitHub Desktop.
Navigates to django site package in a virtualenv
This file contains 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
function d { | |
if [[ $1 == "-f" ]]; then | |
if [[ -n $2 ]]; then | |
pushd $WORKON_HOME/$2/src/django-fusionbox | |
else | |
__d_help | |
fi | |
elif [[ -n $1 ]]; then | |
pushd $(__d_get_site_packages_dir $1)/django | |
else | |
__d_help | |
fi | |
} | |
function __d_get_site_packages_dir { | |
$WORKON_HOME/$1/bin/python -c "import distutils; print(distutils.sysconfig.get_python_lib())" | |
} | |
function __d_help { | |
cat <<HELP | |
Usage: d [-f] <virtualenv> | |
Navigates to the django site package directory for the specified | |
virtualenv. If the -f option is specified, navigates to the | |
django-fusionbox package directory for that virtualenv. | |
HELP | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment