Created
March 2, 2012 01:52
-
-
Save lxneng/1954877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_virtualenv() { | |
if [ -e .venv ]; then | |
workon `cat .venv` | |
fi | |
} | |
venv_cd () { | |
cd "$@" && has_virtualenv | |
} | |
alias cd="venv_cd" | |
# 这是一段shell脚本, 用来`cd`到某个项目中自动激活该项目所属的虚拟环境. | |
# 在项目的根目录中新建一个`.venv`的文件, 里面的内容就是该项目所属virtualenv的名字。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment