@@ -45,7 +45,6 @@ menuInit () {
4545 actualsubmenuname=" Your commands:"
4646 menudatamap=()
4747 ${immediateMode} && printMenuHeading " $1 "
48- echo
4948}
5049
5150# ################################################
@@ -115,6 +114,7 @@ menuItemClm () {
115114# ################################################
116115startMenu () {
117116 while ${continuemenu:= true} ; do
117+ clear
118118 generateMenu
119119 choice
120120 done
@@ -423,7 +423,6 @@ generateMenu () {
423423 OLD_IFS=$IFS
424424 local previoussubmenu previouscolumn submenucount;
425425 submenucount=0
426- clear
427426 for (( index= 0 ; index< ${# menudatamap[@]} ; index++ )) ; do
428427 IFS=" $delimiter " read -r key description action submenu menu column <<< " ${menudatamap[index]}"
429428 IFS=" $delimiter " read -r nextkey nextdescription nextaction nextsubmenu nextmenu nextcolumn <<< " ${menudatamap[((index+1))]}"
@@ -527,7 +526,7 @@ printMenuItem() {
527526# The menu head to stdout
528527# ################################################
529528printMenuHeading (){
530- coloredLog " $1 " " $menuHeadingFGClr " " $menuHeadingBGClr "
529+ draw_rounded_square " $1 "
531530}
532531
533532# ################################################
@@ -541,6 +540,12 @@ printSubmenuHeading(){
541540 coloredLog " $1 " " $submenuFGClr " " $submenuBGClr "
542541}
543542
543+ printLogo () {
544+ echo " ╭───────────────────╮"
545+ echo " │ EasyKey.shellmenu │"
546+ echo " ╰───────────────────╯"
547+ }
548+
544549quit () {
545550 echo " bye bye, homie!"
546551 nowaitonexit
@@ -553,3 +558,50 @@ exitGently () {
553558 exit 1
554559}
555560
561+ formattedTop=" "
562+ formattedBottom=" "
563+ formattedMiddle=" "
564+ draw_rounded_square () {
565+
566+ # Menu title cache
567+ if [ " $formattedTop " != " " ]; then
568+ echo -e " $formattedTop "
569+ echo -e " $formattedMiddle "
570+ echo -e " $formattedBottom "
571+ return
572+ fi
573+
574+ local text=" $1 "
575+ local width=${# text}
576+
577+ local horizontal_line=" ─"
578+ local top_left_corner=" ┌"
579+ local top_right_corner=" ┐"
580+ local bottom_left_corner=" └"
581+ local bottom_right_corner=" ┘"
582+ local vertical_line=" │"
583+
584+ local border=" "
585+ border+=" $top_left_corner "
586+ for (( i= 0 ; i< width+ 2 ; i++ )) ; do
587+ border+=" $horizontal_line "
588+ done
589+ border+=" $top_right_corner "
590+
591+ formattedTop=$( tput setaf $clrWhite ) $( tput setab $clrBlue ) $( tput bold) $border $( tput sgr0)
592+ formattedMiddle=$( tput setaf $clrWhite ) $( tput setab $clrBlue ) $( tput bold) " $vertical_line " $( tput setaf $clrWhite ) $( tput setab $clrBlue ) $( tput bold) $text $( tput sgr0) $( tput setaf $clrWhite ) $( tput setab $clrBlue ) $( tput bold) " $vertical_line " $( tput sgr0)
593+
594+ echo -e " $formattedTop "
595+ echo -e " $formattedMiddle "
596+
597+ border=" $bottom_left_corner "
598+ for (( i= 0 ; i< width+ 2 ; i++ )) ; do
599+ border+=" $horizontal_line "
600+ done
601+ border+=" $bottom_right_corner "
602+
603+ formattedBottom=$( tput setaf $clrWhite ) $( tput setab $clrBlue ) $( tput bold) $border $( tput sgr0)
604+ echo -e " $formattedBottom "
605+
606+ }
607+
0 commit comments