Change table width to 11

Also replace assumption of no cv arguments with worldwide stats instead of Belgium
This commit is contained in:
Michael De Roover 2020-08-09 00:55:06 +02:00
parent 9d8a5d64ca
commit 28c59e5ee2
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 17 additions and 16 deletions

33
cv
View File

@ -1,6 +1,6 @@
#!/bin/bash
w=10
w=11
dfmt="+%Y-%m-%d"
ex(){
@ -10,7 +10,7 @@ ex(){
[ -z $date ] && date=$(date $dfmt)
[ -z $ydate ] && ydate=$(date -d yesterday $dfmt)
title(){
local w=36
local w=39
printf "║ %-${w}s ║\n" "${*}"
}
@ -46,28 +46,28 @@ out(){
}
frame(){
case "$1" in
top) printf "╔══════════════════════════════════════╗\n" ;;
table) printf "║ Statistic ║ Today ║ Yesterday ║\n"
printf "╟────────────╫────────────╫────────────╢\n" ;;
up) printf "╠════════════╦════════════╦════════════╣\n" ;;
down) printf "╚════════════╩════════════╩════════════╝\n" ;;
line) printf "╠════════════╩════════════╩════════════╣\n" ;;
bot) printf "╚══════════════════════════════════════╝\n" ;;
top) printf "╔═════════════════════════════════════════╗\n" ;;
table) printf "║ Statistic Today ║ Yesterday ║\n"
printf "╟────────────────────────╫────────────╢\n" ;;
up) printf "╠════════════════════════╦════════════╣\n" ;;
down) printf "╚════════════════════════╩════════════╝\n" ;;
line) printf "╠════════════════════════╩════════════╣\n" ;;
bot) printf "╚═════════════════════════════════════════╝\n" ;;
esac
}
result(){
frame up
frame table
out Total cases
out "╰> Per 1M" casesPerOneMillion
out "╰> Per 1M " casesPerOneMillion
out Active active
out Critical critical
out New todayCases
out Deaths deaths
out "╰> Per 1M" deathsPerOneMillion
out "╰> Per 1M " deathsPerOneMillion
out Recovered recovered
out Tests tests
out "╰> Per 1M" testsPerOneMillion
out "╰> Per 1M " testsPerOneMillion
getpct testsPerOneMillion
if [ ! -f $data/$ydate-$country ] || [ $(get todayCases) == "0" ]
then
@ -106,18 +106,19 @@ frame top
title "Queried at: $date"
if [ ! -z "$country" ]
then
# This is to be phased out in favor of worldwide stats
# in the else statement.
if [ "$country" == "all" ]
then
endpoint=all
country=world
result
else
endpoint=countries/$country
result
fi
else
# Change this to your own country as desired.
country=Belgium
title "Country has been set to $country."
endpoint=countries/$country
endpoint=all
country=world
result
fi