Remove file removal logic

This commit is contained in:
Michael De Roover 2020-07-08 19:09:45 +02:00
parent 8ac1db42bc
commit 3f298d26e5
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 2 additions and 26 deletions

28
cv
View File

@ -6,9 +6,6 @@ ex(){
}
date=$(date +"%Y-%m-%d")
ydate=$(date -d yesterday +"%Y-%m-%d")
show(){
echo -e "> ${*}"
}
title(){
w=36
printf "║ %-${w}s ║\n" "${*}"
@ -57,30 +54,7 @@ result(){
out Tests tests
out "╰> Per 1M" testsPerOneMillion
frame down
if [ -f "$data/$ydate-$country" ]
then
if [ "$(get todayCases)" == "$(yget todayCases)" ]
then
show "Seems like the stats are the same as yesterday."
show "This could be normal but may mean that the data file is still yesterday's."
show "Do you want to remove it?"
read -rp "Answer (y/n): " answer
if [ "$answer" == "y" ]
then
ex "rm $data/$date-$country"
fi
fi
else
show "Yesterday's data file for this country doesn't exist."
fi
if [ "$(get todayCases)" == "0" ]
then
show "Seems like the cases today are not yet updated."
show "The data file will be removed. Please try again later."
ex "rm $data/$date-$country"
fi
}
frame top
title "Queried at: $date"
if [ ! -z "$country" ]
@ -100,3 +74,5 @@ else
endpoint=countries/$country
result
fi
echo "Note: all file removal logic is removed."