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