From c12e1f5f4608f2fbb22a789420fb8e9e5096cc1a Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Fri, 3 Jul 2020 22:26:50 +0200 Subject: [PATCH] Columnize stats output --- cv | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cv b/cv index 304d4c5..4bbbdd2 100755 --- a/cv +++ b/cv @@ -42,13 +42,19 @@ out(){ w=10 if [ -z $3 ] then - printf "%-${w}s %-${w}s" "$1:" "$(get $2)" "+ $(expr $(get $2) - $(yget $2))" - printf "\n" + printf "║ %-${w}s ║ %-${w}s ║ %-${w}s ║\n" "$1:" "$(get $2)" "+ $(expr $(get $2) - $(yget $2))" else printf "%-${w}s %d\n" "$1:" "$(yget $2)" fi } +frame(){ + case "$1" in + up) printf "╔════════════╦════════════╦════════════╗\n" ;; + down) printf "╚════════════╩════════════╩════════════╝\n" ;; + esac +} result(){ + frame up out Total cases out Active active out Critical critical @@ -56,6 +62,7 @@ result(){ out Deaths deaths out Recovered recovered out Tests tests + frame down if [ -f "$data/$ydate-$country" ] then if [ "$(get todayCases)" == "$(yget todayCases)" ]