dea557ba8362fd0614588d76ca6b7b89130a169e

Author
Michael Aquilina <michaelaquilina@gmail.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

Simplify detection of virtualenv

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index 54a2e6b05b930fab1a6a38571a254d18f2a48be2..d9ffb930dc98cbf512fc28f23d12a618f3376f39 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -6,18 +6,6 @@ PURPLE="\e[35m"
 6 BOLD="\e[1m"
 7 NORMAL="\e[0m"
 8 
 9-
10-if ! type "virtualenv" > /dev/null; then
11-    export DISABLE_AUTOSWITCH_VENV="1"
12-    printf "${BOLD}${RED}"
13-    printf "zsh-autoswitch-virtualenv requires virtualenv to be installed!\n\n"
14-    printf "${NORMAL}"
15-    printf "If this is already installed but you are still seeing this message, \n"
16-    printf "then make sure the ${BOLD}virtualenv${NORMAL} command is in your PATH.\n"
17-    printf "\n"
18-fi
19-
20-
21 function _virtual_env_dir() {
22     local venv_name="$1"
23     local VIRTUAL_ENV_DIR="${AUTOSWITCH_VIRTUAL_ENV_DIR:-$HOME/.virtualenvs}"
24@@ -264,7 +252,14 @@ function disable_autoswitch_virtualenv() {
25 }
26 
27 
28-if [[ -z "$DISABLE_AUTOSWITCH_VENV" ]]; then
29+if ! type "virtualenv" > /dev/null; then
30+    printf "${BOLD}${RED}"
31+    printf "zsh-autoswitch-virtualenv requires virtualenv to be installed!\n\n"
32+    printf "${NORMAL}"
33+    printf "If this is already installed but you are still seeing this message, \n"
34+    printf "then make sure the ${BOLD}virtualenv${NORMAL} command is in your PATH.\n"
35+    printf "\n"
36+else
37     enable_autoswitch_virtualenv
38     check_venv
39 fi