From 3e193e26216c5aac34965baac61b44487b2ca561 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sun, 15 Jan 2023 20:38:36 -0300 Subject: Improved yams error messages --- yams | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/yams b/yams index f6cad96..e8a0035 100755 --- a/yams +++ b/yams @@ -18,6 +18,15 @@ help() { echo "check-vpn checks if the VPN is working as expected" } +send_success_message() { + echo -e $(printf "\e[32m$1\e[0m") +} + +send_error_message() { + echo -e $(printf "\e[31m$1\e[0m") + exit 255 +} + if [ $option == "--help" ]; then help exit 0 @@ -50,11 +59,9 @@ if [ $option == "check-vpn" ]; then echo "$your_ip" echo if [ $qbittorrent_ip == $your_ip ]; then - echo "Your IPs are the same! qBittorrent is NOT working!" - exit 255 + send_error_message "Your IPs are the same! qBittorrent is NOT working! ⚠️" else - echo "Your IPs are different. qBittorrent is working as expected!" - exit 0 + send_success_message "Your IPs are different. qBittorrent is working as expected! ✅ " fi fi -- cgit v1.2.3