v1.1.11 - fixed center function
This commit is contained in:
parent
3f80e3e64b
commit
3d3fa4f0e9
1 changed files with 9 additions and 7 deletions
16
functions
16
functions
|
|
@ -2,7 +2,7 @@
|
||||||
# pyr0ball script functions library
|
# pyr0ball script functions library
|
||||||
|
|
||||||
# Initial Vars
|
# Initial Vars
|
||||||
functionsrev=1.1.10
|
functionsrev=1.1.11
|
||||||
#scriptname="${BASH_SOURCE[0]##*/}"
|
#scriptname="${BASH_SOURCE[0]##*/}"
|
||||||
#rundir="${BASH_SOURCE[0]%/*}"
|
#rundir="${BASH_SOURCE[0]%/*}"
|
||||||
#rundir_absolute=$(cd $rundir && pwd)
|
#rundir_absolute=$(cd $rundir && pwd)
|
||||||
|
|
@ -337,18 +337,20 @@ boxseparator(){
|
||||||
|
|
||||||
# For printing center-justified text. To change the padding character, replace the ' ' <~~ whitespace in front of the '{' in the padding variable
|
# For printing center-justified text. To change the padding character, replace the ' ' <~~ whitespace in front of the '{' in the padding variable
|
||||||
center() {
|
center() {
|
||||||
local padding="";
|
#local padding="";
|
||||||
padding="$(printf '%0.1s' \ {1..100})"
|
#padding="$(printf '%0.1s' \ {1..100})"
|
||||||
#padding=" "
|
#padding=" "
|
||||||
printf '%*.*s %s %*.*s\n' 0 "$(((BOXWIDTH-2-${#1})/2))" "${padding}" "$1" 0 "$(((BOXWIDTH-1-${#1})/2))" "${padding}"
|
#printf '%*.*s %s %*.*s\n' 0 "$(((BOXWIDTH-2-${#1})/2))" "${left_border}${padding}" "$1" 0 "$(((BOXWIDTH-1-${#1})/2))" "${padding}${right_border}"
|
||||||
|
#printf "%s %s %s %s %s\n" "$left_border" "$padding" "$1" "$padding" "$right_border";
|
||||||
|
echo -e "\r${ESC}[$(((BOXWIDTH-2-${#1})/2))C$1\r${ESC}[${BOXWIDTH}C"
|
||||||
}
|
}
|
||||||
|
|
||||||
# For printing spanned text, e.g. single-pair lists ($name...$title)
|
# For printing spanned text, e.g. single-pair lists ($name...$title)
|
||||||
spanner() {
|
spanner() {
|
||||||
# 1: left-side-text, 2: right-side-text
|
# 1: left-side-text, 2: right-side-text
|
||||||
local spanner="";
|
local _spanner="";
|
||||||
eval printf -v spanner \'"%0.1s"\' "-"{1..$[$((BOXWIDTH-4))- 2 - ${#1} - ${#2}]}
|
eval printf -v _spanner \'"%0.1s"\' "-"{1..$[$((BOXWIDTH-4))- 2 - ${#1} - ${#2}]}
|
||||||
printf "%s %s %s\n" "$1" "$spanner" "$2";
|
printf "%s %s %s\n" "$1" "$_spanner" "$2";
|
||||||
}
|
}
|
||||||
|
|
||||||
boxborder(){
|
boxborder(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue