From ebcf852e1e3af9645cf82d1ab9d5f5c2351d6be4 Mon Sep 17 00:00:00 2001 From: Michael De Roover Date: Tue, 4 Aug 2020 23:48:23 +0200 Subject: [PATCH] Make getpct a little bit cleaner --- cv | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cv b/cv index b9301ab..4cda64e 100755 --- a/cv +++ b/cv @@ -1,5 +1,7 @@ #!/bin/bash +w=10 + ex(){ echo -e "> ${*}" $@ @@ -7,7 +9,7 @@ ex(){ [ -z $date ] && date=$(date +"%Y-%m-%d") [ -z $ydate ] && ydate=$(date -d yesterday +"%Y-%m-%d") title(){ - w=36 + local w=36 printf "║ %-${w}s ║\n" "${*}" } @@ -27,9 +29,6 @@ get(){ fi } getpct(){ - # FIXME: Seriously, this is ugly as fuck. Fix ASAP! - # Also don't get this out of dev, kthx - w=10 printf "║ %-${w}s ║ %${w}s ║ %-${w}s ║\n" "" "$(echo "$(bc <<< "scale = 1; $(get $1) / 10000") %")" "" } yget(){ @@ -42,7 +41,6 @@ yget(){ fi } out(){ - w=10 printf "║ %-${w}s ║ %${w}s ║ %-${w}s ║\n" "$1:" "$(get $2)" "+ $(echo "scale = 2; $(get $2) - $(yget $2)" | bc)" } frame(){