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/Rules.nix | 3 ++- Biz/Bild/ShellHook.sh | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'Biz/Bild') diff --git a/Biz/Bild/Rules.nix b/Biz/Bild/Rules.nix index be9fa31..fcdf025 100644 --- a/Biz/Bild/Rules.nix +++ b/Biz/Bild/Rules.nix @@ -128,9 +128,10 @@ in rec { [ p.black p.pylint ])) # tools + nixpkgs.ccze nixpkgs.cmark - nixpkgs.haskell.packages.${ghcCompiler}.fast-tags nixpkgs.figlet + nixpkgs.haskell.packages.${ghcCompiler}.fast-tags nixpkgs.hlint nixpkgs.lolcat nixpkgs.niv.niv 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