From 55c7e1a340a9eddc230a8782b8487844e2876b0d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 30 Dec 2020 20:32:03 -0500 Subject: colorize sentry output --- Biz/Bild/ShellHook.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Biz/Bild/ShellHook.sh') diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh index a41d050..b42ab1d 100644 --- a/Biz/Bild/ShellHook.sh +++ b/Biz/Bild/ShellHook.sh @@ -87,17 +87,28 @@ function run-sentry() { https://simatime.com https://tv.simatime.com https://bsima.me + https://herocomics.app ) + RED='\033[0;31m' + GRN='\033[0;32m' + YEL='\033[0;33m' + NC='\033[0m' # No Color for url in ${urls[@]} do code=$(curl -L --max-time 10 --silent --show-error --insecure \ --output /dev/null \ --write-out "%{http_code}" "$url") - echo "$code $url" + case "$code" in + 2[0-9][0-9]) printf "${GRN}$code $url${NC}\n";; + 3[0-9][0-9]) printf "${YEL}$code $url${NC}\n";; + 4[0-9][0-9]) printf "${YEL}$code $url${NC}\n";; + 5[0-9][0-9]) printf "${RED}$code $url${NC}\n";; + *) printf "${RED}$code $url${NC}\n";; + esac done } export -f run-sentry -alias sentry="watch --exec bash -c run-sentry" +alias sentry="watch --color --exec bash -c run-sentry" # Poor man's ci function run-ci() { -- cgit v1.2.3