Make getpct a little bit cleaner
This commit is contained in:
8
cv
8
cv
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
w=10
|
||||||
|
|
||||||
ex(){
|
ex(){
|
||||||
echo -e "> ${*}"
|
echo -e "> ${*}"
|
||||||
$@
|
$@
|
||||||
@@ -7,7 +9,7 @@ ex(){
|
|||||||
[ -z $date ] && date=$(date +"%Y-%m-%d")
|
[ -z $date ] && date=$(date +"%Y-%m-%d")
|
||||||
[ -z $ydate ] && ydate=$(date -d yesterday +"%Y-%m-%d")
|
[ -z $ydate ] && ydate=$(date -d yesterday +"%Y-%m-%d")
|
||||||
title(){
|
title(){
|
||||||
w=36
|
local w=36
|
||||||
printf "║ %-${w}s ║\n" "${*}"
|
printf "║ %-${w}s ║\n" "${*}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,9 +29,6 @@ get(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
getpct(){
|
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") %")" ""
|
printf "║ %-${w}s ║ %${w}s ║ %-${w}s ║\n" "" "$(echo "$(bc <<< "scale = 1; $(get $1) / 10000") %")" ""
|
||||||
}
|
}
|
||||||
yget(){
|
yget(){
|
||||||
@@ -42,7 +41,6 @@ yget(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
out(){
|
out(){
|
||||||
w=10
|
|
||||||
printf "║ %-${w}s ║ %${w}s ║ %-${w}s ║\n" "$1:" "$(get $2)" "+ $(echo "scale = 2; $(get $2) - $(yget $2)" | bc)"
|
printf "║ %-${w}s ║ %${w}s ║ %-${w}s ║\n" "$1:" "$(get $2)" "+ $(echo "scale = 2; $(get $2) - $(yget $2)" | bc)"
|
||||||
}
|
}
|
||||||
frame(){
|
frame(){
|
||||||
|
Reference in New Issue
Block a user