diff options
author | Robby Russell <robby@planetargon.com> | 2013-04-23 20:33:50 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2013-04-23 20:33:50 -0700 |
commit | 685c746cc7bdc2dc8c38af5c00b4ed14c88ea227 (patch) | |
tree | 9a9477621960afb539b0a80c825d849984b9954e /plugins/autoenv | |
parent | a2c8db9eb34480dd3e2c9d91d4415ee7964d4764 (diff) | |
parent | 4c91f6d13e32d7389cae299d96f6778451a45fc8 (diff) | |
download | zsh-685c746cc7bdc2dc8c38af5c00b4ed14c88ea227.tar.gz zsh-685c746cc7bdc2dc8c38af5c00b4ed14c88ea227.tar.bz2 zsh-685c746cc7bdc2dc8c38af5c00b4ed14c88ea227.zip |
Merge pull request #1565 from serdardalgic/autoenv-plugin
Add autoenv plugin, which adopts using Kenneth Reitz's autoenv.
Diffstat (limited to 'plugins/autoenv')
-rw-r--r-- | plugins/autoenv/autoenv.plugin.zsh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh new file mode 100644 index 000000000..ca5666979 --- /dev/null +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -0,0 +1,18 @@ +# The use_env call below is a reusable command to activate/create a new Python +# virtualenv, requiring only a single declarative line of code in your .env files. +# It only performs an action if the requested virtualenv is not the current one. +use_env() { + typeset venv + venv="$1" + if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then + if workon | grep -q "$venv"; then + workon "$venv" + else + echo -n "Create virtualenv $venv now? (Yn) " + read answer + if [[ "$answer" == "Y" ]]; then + mkvirtualenv "$venv" + fi + fi + fi +} |