diff options
author | Baptiste Darthenay <baptiste@darthenay.fr> | 2016-12-28 11:35:56 +0100 |
---|---|---|
committer | Baptiste Darthenay <baptiste@darthenay.fr> | 2016-12-28 11:35:56 +0100 |
commit | dbbc7dc2950d6b565488864ee8ebf53a73d6e8eb (patch) | |
tree | 55b3bf29f027bb7f3ab12dd0bd2ec2eac79ee94b | |
parent | ef80fa0bec2df62c2ea5469123b4ad794c7c9306 (diff) |
Jumps to project directory if exists.
-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" |