Clean up frame function

This commit is contained in:
2020-08-14 19:54:24 +02:00
parent 731c9fd800
commit 8e101a2413

18
cv
View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Variable declarations go here. # Variable declarations go here.
w=14 w=15
dfmt="+%Y-%m-%d" dfmt="+%Y-%m-%d"
data="$HOME/Documents/cv" data="$HOME/Documents/cv"
country=$1 country=$1
@@ -18,7 +18,7 @@ fi
# Functions go here. # Functions go here.
title(){ title(){
local w=48 local w=51
printf "║ %-${w}s ║\n" "${*}" printf "║ %-${w}s ║\n" "${*}"
} }
@@ -32,7 +32,7 @@ get(){
fi fi
} }
getpm(){ getpm(){
out "╰> Per 1M " "$(get $1) ($(echo "$(bc <<< "scale = 1; $(get $1) / 10000")%"))" "" out "╰> Per 1M " "$(get $1) ($(echo "$(bc <<< "scale = 1; $(get $1) / 10000")%"))" ""
} }
yget(){ yget(){
date=$ydate date=$ydate
@@ -51,12 +51,12 @@ out(){
} }
frame(){ frame(){
case "$1" in case "$1" in
top) printf "╔══════════════════════════════════════════════════╗\n" ;; top) printf "╔ %-${w}s ═ %-${w}s ═ %-${w}s ╗\n" | sed "s/\ /═/g" ;;
sep) printf "╟────────────────╫────────────────╫────────────────╢\n" ;; sep) printf "╟ %-${w}s ╫ %-${w}s ╫ %-${w}s ╢\n" | sed "s/\ /─/g" ;;
up) printf "╠════════════════╦════════════════╦════════════════╣\n" ;; up) printf "╠ %-${w}s ╦ %-${w}s ╦ %-${w}s ╣\n" | sed "s/\ /═/g" ;;
down) printf "╚════════════════╩════════════════╩════════════════╝\n" ;; down) printf "╚ %-${w}s ╩ %-${w}s ╩ %-${w}s ╝\n" | sed "s/\ /═/g" ;;
line) printf "╠════════════════╩════════════════╩════════════════╣\n" ;; line) printf "╠ %-${w}s ╩ %-${w}s ╩ %-${w}s ╣\n" | sed "s/\ /═/g" ;;
bot) printf "╚══════════════════════════════════════════════════╝\n" ;; bot) printf "╚ %-${w}s ═ %-${w}s ═ %-${w}s ╝\n" | sed "s/\ /═/g" ;;
esac esac
} }
result(){ result(){