Separate show and title functions

This commit is contained in:
Michael De Roover 2020-07-03 23:49:32 +02:00
parent 75dd29e52d
commit 902d6a9ad7
Signed by: vim
GPG Key ID: 075496E232CE04CB

12
cv
View File

@ -7,6 +7,9 @@ ex(){
date=$(date +"%Y-%m-%d") date=$(date +"%Y-%m-%d")
ydate=$(date -d yesterday +"%Y-%m-%d") ydate=$(date -d yesterday +"%Y-%m-%d")
show(){ show(){
echo -e "\\033[0;36m> ${*} \\033[0m"
}
title(){
w=36 w=36
printf "║ %-${w}s ║\n" "${*}" printf "║ %-${w}s ║\n" "${*}"
} }
@ -15,10 +18,7 @@ data="$HOME/Documents/cv"
[ ! -d "$data" ] && ex "mkdir -p $data" [ ! -d "$data" ] && ex "mkdir -p $data"
# If not set by an environment variable, set country to $1. # If not set by an environment variable, set country to $1.
if [ -z "$country" ] [ -z "$country" ] && country=$1
then
country=$1
fi
get(){ get(){
if [ -f "$data/$date-$country" ] if [ -f "$data/$date-$country" ]
@ -82,7 +82,7 @@ result(){
} }
frame top frame top
show "Queried at: $date" title "Queried at: $date"
if [ ! -z "$country" ] if [ ! -z "$country" ]
then then
if [ "$country" == "all" ] if [ "$country" == "all" ]
@ -96,7 +96,7 @@ then
else else
# Change this to your own country as desired. # Change this to your own country as desired.
country=Belgium country=Belgium
show "Country has been set to $country." title "Country has been set to $country."
endpoint=countries/$country endpoint=countries/$country
result result
fi fi