diff --git a/cv b/cv index 4cda64e..2250c06 100755 --- a/cv +++ b/cv @@ -1,13 +1,14 @@ #!/bin/bash w=10 +dfmt="+%Y-%m-%d" ex(){ echo -e "> ${*}" $@ } -[ -z $date ] && date=$(date +"%Y-%m-%d") -[ -z $ydate ] && ydate=$(date -d yesterday +"%Y-%m-%d") +[ -z $date ] && date=$(date $dfmt) +[ -z $ydate ] && ydate=$(date -d yesterday $dfmt) title(){ local w=36 printf "║ %-${w}s ║\n" "${*}" @@ -90,6 +91,17 @@ result(){ frame down fi } + +# Main code starts here. + +# Get yesterday's stats for queries after midnight. +# Not pretty but it works I guess... +if [ "$2" == "yesterday" ] +then + date=$(date -d yesterday $dfmt) + ydate=$(date -d "2 days ago" $dfmt) +fi + frame top title "Queried at: $date" if [ ! -z "$country" ]