From dbbc7dc2950d6b565488864ee8ebf53a73d6e8eb Mon Sep 17 00:00:00 2001 From: Baptiste Darthenay Date: Wed, 28 Dec 2016 11:35:56 +0100 Subject: Jumps to project directory if exists. --- README.md | 5 +++++ venvworkon.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 3376c4b..acbec3b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,11 @@ If the file `$HOME/.venvs//postactivate.sh` exists, it is automatically sourced after the venv is activated. This is useful to export environment variable such as `DJANGO_SETTINGS_MODULE`. +## Project directory +If `PROJECT_HOME` is set (e.g. `$HOME/Projects`) and there is +a project folder which match the environment name, venvworkon +change the current working directory to the project directory. + ## Why bother using this `virtualenvwrapper` is certainly much more feature-packed and useful than this. But this wrapper is handy for development and diff --git a/venvworkon.sh b/venvworkon.sh index f6ac4ef..960048b 100755 --- a/venvworkon.sh +++ b/venvworkon.sh @@ -26,6 +26,11 @@ workon() { source "$envdir/bin/activate" + if [ -d "$PROJECT_HOME/$envname" ] + then + cd "$PROJECT_HOME/$envname" + fi + if [ -e "$envdir/postactivate.sh" ] then source "$envdir/postactivate.sh" -- cgit v1.2.3