From 902d6a9ad76e71d352bc8a46ffb5e99453fbf961 Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Fri, 3 Jul 2020 23:49:32 +0200 Subject: [PATCH] Separate show and title functions --- cv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cv b/cv index a3f639b..99a47f8 100755 --- a/cv +++ b/cv @@ -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