Created
March 30, 2020 06:15
-
-
Save alexkiro/ccf4b5283fb0147d5511f0626ba2ba94 to your computer and use it in GitHub Desktop.
Activate current env on cd
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
export ENV_PATHS=.venv/bin/activate:venv/bin/activate:env/bin/activate:../.venv/bin/activate:../venv/bin/activate:./bin/activate:.envrc | |
activate() { | |
for pos_file in $(echo $ENV_PATHS | tr ":" "\n") | |
do | |
if [ -f "$pos_file" ] | |
then | |
source "$pos_file" | |
fi | |
done | |
} | |
cd() { | |
builtin cd "$@" || return 1 | |
activate | |
} | |
activate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment