Skip to content

Instantly share code, notes, and snippets.

View BGBRWR's full-sized avatar
🦖

Austin Walker BGBRWR

🦖
View GitHub Profile
@BGBRWR
BGBRWR / workit.bash
Last active February 10, 2019 06:58 — forked from gibatronic/workit.bash
Automatically run workon when entering a directory
function check_for_virtual_env {
[ -d .git ] || git rev-parse --git-dir &> /dev/null
if [ $? -eq 0 ]; then
local ENV_NAME=`basename \`pwd\``
if [ "${VIRTUAL_ENV##*/}" != $ENV_NAME ] && [ -e $WORKON_HOME/$ENV_NAME/bin/activate ]; then
workon $ENV_NAME && export CD_VIRTUAL_ENV=$ENV_NAME
fi
elif [ $CD_VIRTUAL_ENV ]; then