Diff
1diff --git a/CHANGELOG.rst b/CHANGELOG.rst
2index 90145377bb8914f8aafbea2876ac0b30311fc109..90cf6668ed6ff456dc1d695a9a9650dd879127dc 100644
3--- a/CHANGELOG.rst
4+++ b/CHANGELOG.rst
5@@ -1,6 +1,10 @@
6 Changelog
7 =========
8
9+0.3.0
10+-----
11+* Disable plugin and print help message if virtualenvwrapper not setup correctly
12+
13 0.2.1
14 -----
15 * Add tests for mkvenv and check_venv
16diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
17index a80a43c61a7a9572ba0d77dab088716112e94c05..c4190b52b5f2fc8a35031bda8cf71f579d4a1e27 100644
18--- a/autoswitch_virtualenv.plugin.zsh
19+++ b/autoswitch_virtualenv.plugin.zsh
20@@ -1,3 +1,14 @@
21+if ! type workon > /dev/null; then
22+ export DISABLE_AUTOSWITCH_VENV="1"
23+ printf "\e[1m\e[31m"
24+ printf "zsh-autoswitch-virtualenv requires virtualenvwrapper to be installed!\n\n"
25+ printf "If this is already installed but you are still seeing this message, add the "
26+ printf "following to your ~/.zshrc:\n"
27+ printf "\e[39m"
28+ printf "source =virtualenvwrapper.sh\n"
29+ printf "\e[0m"
30+fi
31+
32 function _maybeworkon() {
33 if [[ -z "$VIRTUAL_ENV" || "$1" != "$(basename $VIRTUAL_ENV)" ]]; then
34 if [ -z "$AUTOSWITCH_SILENT" ]; then
35diff --git a/tests/test_help.zunit b/tests/test_help.zunit
36new file mode 100644
37index 0000000000000000000000000000000000000000..b50c2435f18a8cc2c12a33ad4628fe6361abdfbd
38--- /dev/null
39+++ b/tests/test_help.zunit
40@@ -0,0 +1,11 @@
41+#!/usr/bin/env zunit
42+
43+@test 'prints help message and disables plugin if virtualenvwrapper not setup' {
44+ run load ../autoswitch_virtualenv.plugin.zsh
45+
46+ assert $status equals 0
47+ assert "$lines[1]" contains "zsh-autoswitch-virtualenv requires virtualenvwrapper to be installed!"
48+ assert "$lines[2]" is_empty
49+ assert "$lines[3]" contains "If this is already installed but you are still seeing this message, add the following to your ~/.zshrc"
50+ assert "$lines[4]" contains "source =virtualenvwrapper.sh"
51+}