File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,20 @@ The ``predeactivate`` script is source before the current environment is deactiv
5858be used to disable or clear settings in your environment. ``$VIRTUAL_ENV`` refers to the old
5959environment at the time the script runs.
6060
61+ $WORKON_HOME/postactivate
62+ =============================
63+
64+ The global ``postactivate`` script is sourced after the new environment is enabled and the new
65+ environment's postactivate is sourced (if it exists). ``$VIRTUAL_ENV`` refers to the new
66+ environment at the time the script runs.
67+
68+ This example script adds a space between the virtual environment name and your old PS1 by making
69+ use of ``_OLD_VIRTUAL_PS1``.
70+
71+ ::
72+
73+ PS1="(`basename \"$VIRTUAL_ENV\"`) $_OLD_VIRTUAL_PS1"
74+
6175$WORKON_HOME/premkvirtualenv
6276=============================
6377
@@ -104,6 +118,7 @@ Updates
104118
1051191.10
106120 - Pull in fix for colorized ls from Jeff Forcier (b42a25f7b74a).
121+ - Add global postactivate hook.
107122
1081231.9
109124 - Add more hooks for operations to run before and after creating or deleting environments based on changes from Chris Hasenpflug.
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ mk_test_hook premkvirtualenv
1515mk_test_hook postmkvirtualenv
1616mk_test_hook prermvirtualenv
1717mk_test_hook postrmvirtualenv
18+ mk_test_hook postactivate
1819
1920echo
2021echo " HOOKS:"
Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ function workon () {
145145 source "$activate"
146146
147147 virtualenvwrapper_source_hook "$VIRTUAL_ENV/bin/postactivate"
148+
149+ virtualenvwrapper_source_hook "$WORKON_HOME/postactivate"
150+
148151 return 0
149152}
150153
You can’t perform that action at this time.
0 commit comments