cde038a96f88cfd4d2f2b35fd92365cdf5037f8c

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

Message

Color more output

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index b0a4408e50f767e8182f74b00598726ef36a9110..5b20ca4391be4edb97a307f2cd968511b71c8ecd 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -103,11 +103,11 @@ function check_venv()
 6           if [[ "$file_owner" != "$(id -u)" ]]; then
 7             printf "AUTOSWITCH WARNING: Virtualenv will not be activated\n\n"
 8             printf "Reason: Found a .venv file but it is not owned by the current user\n"
 9-            printf "Change ownership of $venv_path to '$USER' to fix this\n"
10+            printf "Change ownership of ${PURPLE}$venv_path${NORMAL} to ${PURPLE}'$USER'${NORMAL} to fix this\n"
11           elif ! [[ "$file_permissions" =~ ^[64][04][04]$ ]]; then
12             printf "AUTOSWITCH WARNING: Virtualenv will not be activated\n\n"
13             printf "Reason: Found a .venv file with weak permission settings ($file_permissions).\n"
14-            printf "Run the following command to fix this: \"chmod 600 $venv_path\"\n"
15+            printf "Run the following command to fix this: ${PURPLE}\"chmod 600 $venv_path\"${NORMAL}\n"
16           else
17             SWITCH_TO="$(<"$venv_path")"
18           fi
19@@ -191,7 +191,7 @@ function install_requirements() {
20     setopt nullglob
21     for requirements in *requirements.txt
22     do
23-      printf "Found a %s file. Install? [y/N]: " "$requirements"
24+      printf "Found a ${PURPLE}%s${NORMAL} file. Install? [y/N]: " "$requirements"
25       read ans
26 
27       if [[ "$ans" = "y" || "$ans" = "Y" ]]; then
28diff --git a/tests/test_check_venv.zunit b/tests/test_check_venv.zunit
29index b419c0159c532fd6dfd34d3ed5f9924ee5005f3a..532a7b45438a6bfe2a353c1543a1cca5db2e4ead 100644
30--- a/tests/test_check_venv.zunit
31+++ b/tests/test_check_venv.zunit
32@@ -39,7 +39,7 @@
33     assert "$lines[1]" same_as "AUTOSWITCH WARNING: Virtualenv will not be activated"
34     assert "$lines[2]" is_empty
35     assert "$lines[3]" same_as "Reason: Found a .venv file with weak permission settings (620)."
36-    assert "$lines[4]" same_as "Run the following command to fix this: \"chmod 600 $TARGET/.venv\""
37+    assert "$lines[4]" same_as "Run the following command to fix this: \e[35m\"chmod 600 $TARGET/.venv\"\e[0m"
38 }
39 
40 @test 'check_venv - Security warning for weak writeable by everyone permissions' {
41@@ -55,7 +55,7 @@
42     assert "$lines[1]" same_as "AUTOSWITCH WARNING: Virtualenv will not be activated"
43     assert "$lines[2]" is_empty
44     assert "$lines[3]" same_as "Reason: Found a .venv file with weak permission settings (622)."
45-    assert "$lines[4]" same_as "Run the following command to fix this: \"chmod 600 $TARGET/.venv\""
46+    assert "$lines[4]" same_as "Run the following command to fix this: \e[35m\"chmod 600 $TARGET/.venv\"\e[0m"
47 }
48 
49 @test 'check_venv - No security warning for readable by everyone permission' {