summaryrefslogtreecommitdiff
path: root/plugins/autoenv
diff options
context:
space:
mode:
authorDiego Costa R <62116423+diegocostares@users.noreply.github.com>2023-06-05 04:25:17 -0400
committerGitHub <noreply@github.com>2023-06-05 10:25:17 +0200
commitb36c90d9abd2fd2ffe53d19b11e47077dfdb38a8 (patch)
treea6e77cca55835c0cbbffba3a298e5de696195883 /plugins/autoenv
parent62ab5406dd89848bb26e8c6e648eb7d860e9dce5 (diff)
downloadzsh-b36c90d9abd2fd2ffe53d19b11e47077dfdb38a8.tar.gz
zsh-b36c90d9abd2fd2ffe53d19b11e47077dfdb38a8.tar.bz2
zsh-b36c90d9abd2fd2ffe53d19b11e47077dfdb38a8.zip
feat(autoenv): macOS compatibility, add more dirs (#11724)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/autoenv')
-rw-r--r--plugins/autoenv/autoenv.plugin.zsh16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
index 229a8a834..cbf7cefbb 100644
--- a/plugins/autoenv/autoenv.plugin.zsh
+++ b/plugins/autoenv/autoenv.plugin.zsh
@@ -17,9 +17,13 @@ if ! type autoenv_init >/dev/null; then
/usr/local/bin
/usr/share/autoenv-git
~/Library/Python/bin
+ .venv/bin
+ venv/bin
+ env/bin
+ .env/bin
)
for d ( $install_locations ); do
- if [[ -e $d/activate.sh ]]; then
+ if [[ -e $d/activate || -e $d/activate.sh ]]; then
autoenv_dir=$d
break
fi
@@ -29,13 +33,13 @@ if ! type autoenv_init >/dev/null; then
# Look for Homebrew path as a last resort
if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
d=$(brew --prefix)/opt/autoenv
- if [[ -e $d/activate.sh ]]; then
+ if [[ -e $d/activate || -e $d/activate.sh ]]; then
autoenv_dir=$d
fi
fi
# Complain if autoenv is not installed
- if [[ -z $autoenv_dir ]]; then
+ if [[ -z $autoenv_dir ]]; then
cat <<END >&2
-------- AUTOENV ---------
Could not locate autoenv installation.
@@ -46,7 +50,11 @@ END
return 1
fi
# Load autoenv
- source $autoenv_dir/activate.sh
+ if [[ -e $autoenv_dir/activate ]];
+ source $autoenv_dir/activate
+ else
+ source $autoenv_dir/activate.sh
+ fi
fi
}
[[ $? != 0 ]] && return $?