Skip to content

Commit 0f0fe1f

Browse files
committed
Nice heading graphic
1 parent 2b45a99 commit 0f0fe1f

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

EasyKey.git/git.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ git fetch --all --tags 2> /dev/null
1616
while ${continuemenu:=true}; do
1717
clear
1818
menuInit "Super GIT Home"
19+
echo
1920
submenuHead "Working with remotes:"
2021
menuItemClm a "Gently push current" pushActual b "Set remote origin repo" setRemoteOrigin
2122
menuItemClm e "Set upstream to current" setUpstream f "Administer remotes" adminRemotes

EasyKey.kubectl/ezk-kubectl-functions.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
function listImagesInUse() {
44

5-
namespaces=("sls-alfred" "sls-pennyworth")
6-
5+
selectItem "kubectl get ns" "awk '{print \$1}'"
6+
if [[ $fname == "" ]]; then return 0; fi
7+
namespaces=("$fname")
78
contexts=$(kubectl config get-contexts -o name)
89

910
for context in $contexts; do

EasyKey.kubectl/kubectl.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ immediateMode=true
1414
while ${continuemenu:=true}; do
1515
clear
1616
menuInit "Super KUBECTL Home"
17+
echo
1718
echo "Current context: $(kubectl config current-context)"
1819
echo "Namespace: $(kubectl config view --minify -o jsonpath='{..namespace}')"
1920
echo

shellmenu.sh

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
#################################################
116115
startMenu() {
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
#################################################
529528
printMenuHeading(){
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+
544549
quit () {
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

Comments
 (0)