diff options
-rw-r--r-- | README.md | 5 | ||||
-rwxr-xr-x | venvworkon.sh | 5 |
2 files changed, 10 insertions, 0 deletions
@@ -28,6 +28,11 @@ If the file `$HOME/.venvs/<venv>/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" |