Make getpct a little bit cleaner

This commit is contained in:
Michael De Roover 2020-08-04 23:48:23 +02:00
parent 082f7bf39f
commit ebcf852e1e
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 3 additions and 5 deletions

8
cv
View File

@ -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(){