diff options
author | Robby Russell <robby@planetargon.com> | 2015-10-09 07:18:02 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2015-10-09 07:18:02 -0700 |
commit | 0be21f025e6f77e936b7b373f1a2a14b4a7145ba (patch) | |
tree | 53d423979d2257f9185a8bf57b3e337ed9cdae35 | |
parent | 01448020a750256f8ce68f9cf348a4f029bda946 (diff) | |
parent | c146853a5e529a522ca4cd6015cd55b796788806 (diff) | |
download | zsh-0be21f025e6f77e936b7b373f1a2a14b4a7145ba.tar.gz zsh-0be21f025e6f77e936b7b373f1a2a14b4a7145ba.tar.bz2 zsh-0be21f025e6f77e936b7b373f1a2a14b4a7145ba.zip |
Merge pull request #4440 from apjanke/autoenv-homebrew
autoenv: support homebrew-installed autoenv
-rw-r--r-- | plugins/autoenv/autoenv.plugin.zsh | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index a8271849e..c9f968118 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,12 +1,25 @@ # Activates autoenv or reports its failure -if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then - echo '-------- AUTOENV ---------' - echo 'Could not find ~/.autoenv/activate.sh.' - echo 'Please check if autoenv is correctly installed.' - echo 'In the meantime the autoenv plugin is DISABLED.' - echo '--------------------------' - return 1 +() { +if ! type autoenv_init >/dev/null; then + for d (~/.autoenv /usr/local/opt/autoenv); do + if [[ -e $d/activate.sh ]]; then + autoenv_dir=$d + break + fi + done + if [[ -z $autoenv_dir ]]; then + cat <<END >&2 +-------- AUTOENV --------- +Could not locate autoenv installation. +Please check if autoenv is correctly installed. +In the meantime the autoenv plugin is DISABLED. +-------------------------- +END + return 1 + fi fi +} +[[ $? != 0 ]] && return $? # 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. |