Skip to content

Commit 04899f0

Browse files
committed
Adding virtualenv_wrapper helper script.
Adding has_virtualenv function which will look for a .venv file in the directory. If it exists, it will attempt to `workon` the project whose name is written in the file. For instance, if my .venv file contains the text: oebfare It will attempt to `workon oebfare`. As there shouldn't be a .venv file in a directory that doesn't have a virtual env, there is no error handling. This should be fixed.
1 parent a98ae22 commit 04899f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.bash_profile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ PS1="${RED}:${NORMAL}\@${RED}: ${CYAN}(${NORMAL}\w${CYAN})${GREEN} \$(parse_svn_
222222

223223
source $HOME/bin/virtualenvwrapper_bashrc
224224

225+
has_virtualenv() {
226+
if [ -e .venv ]; then
227+
workon `cat .venv`
228+
fi
229+
}
230+
venv_cd () {
231+
cd "$@" && has_virtualenv
232+
}
233+
alias cd="venv_cd"
225234

226235
# Welcome Message
227236
echo -e ""

0 commit comments

Comments
 (0)