Initial state of cv
This commit is contained in:
commit
d84bc9fb23
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /usr/local/bin/vars
|
||||
|
||||
country=$1
|
||||
|
||||
get(){
|
||||
if [ -f /tmp/cv/$date-$country ]
|
||||
then
|
||||
cat /tmp/cv/$date-$country
|
||||
else
|
||||
curl -sL corona.lmao.ninja/v2/$endpoint > /tmp/cv/$date-$country
|
||||
cat /tmp/cv/$date-$country
|
||||
fi
|
||||
}
|
||||
result(){
|
||||
echo "Total: $(get | jq -r '.cases')"
|
||||
echo "Active: $(get | jq -r '.active')"
|
||||
echo "Today: $(get | jq -r '.todayCases')"
|
||||
echo "Tests: $(get | jq -r '.tests')"
|
||||
}
|
||||
|
||||
show "Queried at: $date"
|
||||
if [ ! -z $country ]
|
||||
then
|
||||
if [ "$country" == "all" ]
|
||||
then
|
||||
endpoint=all
|
||||
result
|
||||
else
|
||||
endpoint=countries/$country
|
||||
result
|
||||
fi
|
||||
else
|
||||
country=Belgium
|
||||
show "Country has been set to $country."
|
||||
endpoint=countries/$country
|
||||
result
|
||||
fi
|
Reference in New Issue