c146853a5e529a522ca4cd6015cd55b796788806

Author
Andrew Janke <andrew@apjanke.net>
Committer
Andrew Janke <andrew@apjanke.net>
Date

Message

autoenv: also look in the Homebrew installation location for it

Diff

 1diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
 2index edc16a4caba228a919d84c758ae8465579ecc777..c9f968118706b4e882fe61cd1bd494cc01c62ac7 100644
 3--- a/plugins/autoenv/autoenv.plugin.zsh
 4+++ b/plugins/autoenv/autoenv.plugin.zsh
 5@@ -1,12 +1,25 @@
 6 # Activates autoenv or reports its failure
 7-if ! type autoenv_init &>/dev/null && ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
 8-  echo '-------- AUTOENV ---------'
 9-  echo 'Could not find autoenv_init function or ~/.autoenv/activate.sh.'
10-  echo 'Please check if autoenv is correctly installed.'
11-  echo 'In the meantime the autoenv plugin is DISABLED.'
12-  echo '--------------------------'
13-  return 1
14+() {
15+if ! type autoenv_init >/dev/null; then
16+  for d (~/.autoenv /usr/local/opt/autoenv); do
17+    if [[ -e $d/activate.sh ]]; then
18+      autoenv_dir=$d
19+      break
20+    fi
21+  done
22+  if [[ -z $autoenv_dir ]]; then 
23+    cat <<END >&2
24+-------- AUTOENV ---------
25+Could not locate autoenv installation.
26+Please check if autoenv is correctly installed.
27+In the meantime the autoenv plugin is DISABLED.
28+--------------------------
29+END
30+    return 1
31+  fi
32 fi
33+}
34+[[ $? != 0 ]] && return $?
35 
36 # The use_env call below is a reusable command to activate/create a new Python
37 # virtualenv, requiring only a single declarative line of code in your .env files.