re-ordered functions, added logging to boxline
This commit is contained in:
parent
f61e810829
commit
718e324a6b
1 changed files with 47 additions and 45 deletions
92
functions
92
functions
|
|
@ -321,7 +321,7 @@ boxbottom() {
|
||||||
}
|
}
|
||||||
|
|
||||||
boxline() {
|
boxline() {
|
||||||
echo -e "$left_border $1\r${ESC}[${BOXWIDTH}C$right_border"
|
logger echo -e "$left_border $1\r${ESC}[${BOXWIDTH}C$right_border"
|
||||||
}
|
}
|
||||||
|
|
||||||
boxseparator(){
|
boxseparator(){
|
||||||
|
|
@ -329,6 +329,25 @@ boxseparator(){
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boxborder(){
|
||||||
|
boxtop
|
||||||
|
for line in "$@" ; do
|
||||||
|
boxline "$line"
|
||||||
|
done
|
||||||
|
boxbottom
|
||||||
|
}
|
||||||
|
|
||||||
|
subboxborder(){
|
||||||
|
BOXWIDTH_ORG=$BOXWIDTH
|
||||||
|
BOXWIDTH=$(($BOXWIDTH*75/100))
|
||||||
|
boxline $(boxtop)
|
||||||
|
for line in "$@" ; do
|
||||||
|
boxline $(boxline "$line")
|
||||||
|
done
|
||||||
|
boxline $(boxbottom)
|
||||||
|
BOXWIDTH=$BOXWIDTH_ORG
|
||||||
|
}
|
||||||
|
|
||||||
# # 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() {
|
||||||
# padding="$(printf '%0.1s' {1..500})"
|
# padding="$(printf '%0.1s' {1..500})"
|
||||||
|
|
@ -355,50 +374,7 @@ spanner() {
|
||||||
printf "%s %s %s\n" "$1" "$_spanner" "$2";
|
printf "%s %s %s\n" "$1" "$_spanner" "$2";
|
||||||
}
|
}
|
||||||
|
|
||||||
boxborder(){
|
# Workflow and logging
|
||||||
boxtop
|
|
||||||
for line in "$@" ; do
|
|
||||||
boxline "$line"
|
|
||||||
done
|
|
||||||
boxbottom
|
|
||||||
}
|
|
||||||
|
|
||||||
subboxborder(){
|
|
||||||
BOXWIDTH_ORG=$BOXWIDTH
|
|
||||||
BOXWIDTH=$(($BOXWIDTH*75/100))
|
|
||||||
boxline $(boxtop)
|
|
||||||
for line in "$@" ; do
|
|
||||||
boxline $(boxline "$line")
|
|
||||||
done
|
|
||||||
boxline $(boxbottom)
|
|
||||||
BOXWIDTH=$BOXWIDTH_ORG
|
|
||||||
}
|
|
||||||
|
|
||||||
success(){
|
|
||||||
_line="$@"
|
|
||||||
echo -e "\n"
|
|
||||||
logger boxborder "${scriptname} ${grn}SUCCESS${dfl} ${_line}"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
warn(){
|
|
||||||
ec=$?
|
|
||||||
_line="$@"
|
|
||||||
echo -e "\n"
|
|
||||||
boxtop
|
|
||||||
logger boxline "${lrd}WARNING${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
|
||||||
boxbottom
|
|
||||||
}
|
|
||||||
|
|
||||||
fail(){
|
|
||||||
ec=$?
|
|
||||||
_line="$@"
|
|
||||||
echo -e "\n"
|
|
||||||
boxtop
|
|
||||||
logger boxline "${lrd}FAILED${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
|
||||||
boxbottom
|
|
||||||
exit $ec
|
|
||||||
}
|
|
||||||
|
|
||||||
pushd(){
|
pushd(){
|
||||||
command pushd "$@" > /dev/null
|
command pushd "$@" > /dev/null
|
||||||
|
|
@ -530,6 +506,32 @@ install-dir() {
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
|
|
||||||
|
success(){
|
||||||
|
_line="$@"
|
||||||
|
echo -e "\n"
|
||||||
|
logger boxborder "${scriptname} ${grn}SUCCESS${dfl} ${_line}"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
warn(){
|
||||||
|
ec=$?
|
||||||
|
_line="$@"
|
||||||
|
echo -e "\n"
|
||||||
|
boxtop
|
||||||
|
logger boxline "${lrd}WARNING${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
||||||
|
boxbottom
|
||||||
|
}
|
||||||
|
|
||||||
|
fail(){
|
||||||
|
ec=$?
|
||||||
|
_line="$@"
|
||||||
|
echo -e "\n"
|
||||||
|
boxtop
|
||||||
|
logger boxline "${lrd}FAILED${lyl}[${ong}code=${red}$ec${lyl}]: ${_line}${dfl}"
|
||||||
|
boxbottom
|
||||||
|
exit $ec
|
||||||
|
}
|
||||||
|
|
||||||
clone-repo(){
|
clone-repo(){
|
||||||
# git clone <source url> <destination>
|
# git clone <source url> <destination>
|
||||||
local _url=$1
|
local _url=$1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue