-
-
Save eseceve/4370295 to your computer and use it in GitHub Desktop.
override "cd" command. Now:
- Check virtualenv for activate/deactivate. - Check git and show a status.
- Show directory files (with "ls").
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
# cd + virtualenv activation + ls + git status | |
function cd() { | |
# default cd | |
builtin cd $1; | |
# virtualenv activation | |
GIT_DIR=`git rev-parse --git-dir 2> /dev/null` | |
if [[ $? == 0 ]] | |
then | |
if [[ -f $GIT_DIR/../.env/bin/activate ]] | |
then | |
. $GIT_DIR/../.env/bin/activate | |
fi | |
else | |
if [[ $VIRTUAL_ENV != "" ]] | |
then | |
deactivate | |
fi | |
fi | |
# optional ls | |
ls | |
if [ -d .git ]; then | |
git status | |
fi; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment