diff --git a/cv b/cv index d9e3152..ed4afd9 100755 --- a/cv +++ b/cv @@ -44,17 +44,26 @@ yget(){ date=$ydate get "$1" } +out(){ + w=10 + if [ -z $3 ] + then + printf "%-${w}s %d\n" "$1:" "$(get $2)" + else + printf "%-${w}s %d\n" "$1:" "$(yget $2)" + fi +} result(){ - echo "Total: $(get cases)" - echo "Active: $(get active)" - echo "New: $(get todayCases)" - echo "Deaths: $(get deaths)" - echo "Recovered: $(get recovered)" - echo "Tests: $(get tests)" + out Total cases + out Active active + out New todayCases + out Deaths deaths + out Recovered recovered + out Tests tests if [ -f "$data/$ydate-$country" ] then show "Yesterday's stats:" - echo "New: $(yget todayCases)" + out New todayCases yesterday if [ "$(get todayCases)" == "$(yget todayCases)" ] then show "Seems like the stats are the same as yesterday."