Skip to content

Commit 4655241

Browse files
committed
Action banner
1 parent b5b3180 commit 4655241

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

shellmenu.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ clrBlue=4
1616
clrPurple=5
1717
clrCyan=6
1818
clrWhite=7
19+
clrGray=237
1920

2021
# Globals (SUBJECT TO CUSTOMIZATION)
2122
waitstatus=true # whether to wait for key press after menu command finished
@@ -429,7 +430,8 @@ callKeyFunktion () {
429430
IFS="$delimiter" read -r key description action submenu menu column <<< "$i"
430431
if [ "$1" = "$key" ]
431432
then
432-
clear && importantLog "$action"
433+
clear && actionBanner "$description"
434+
importantLog "$action"
433435
eval "$action"
434436
return 1
435437
fi
@@ -438,6 +440,13 @@ callKeyFunktion () {
438440
IFS=$OLD_IFS
439441
}
440442

443+
actionBanner() {
444+
local bannerline="$(r_pad " Action Execution" "75" " ")"
445+
coloredLog "$bannerline" $clrWhite $clrBlue && echo
446+
local actionline="$(r_pad " $1" "75" " ")"
447+
coloredLog "$actionline" $clrWhite $clrGray && echo
448+
}
449+
441450
#################################################
442451
# Generates the menu from the menudatamap.
443452
# Globals:
@@ -591,9 +600,10 @@ printSubmenuHeading(){
591600
# Padded line to stdout
592601
#################################################
593602
r_pad() {
594-
local text=$1
595-
local length=${#text}
596-
local width=${2:-$length}
603+
local text="$1"
604+
local length="${#text}"
605+
local width="${2:-$length}"
606+
local symbol="${3:- }"
597607
local paddedcount=$(( width - length ))
598608
local printout="$text$(printf "%-${paddedcount}s" "" | tr " " "$symbol")"
599609
printf "%s" "$printout"

0 commit comments

Comments
 (0)