Skip to content

Commit 3d51bf8

Browse files
authored
Merge pull request #3 from nschlimm/feature/newheading
Feature/newheading
2 parents b75d535 + b0341d6 commit 3d51bf8

File tree

6 files changed

+140
-9
lines changed

6 files changed

+140
-9
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
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
mvnCleanEclipse(){
2+
mvn clean:clean
3+
mvn eclipse:clean
4+
mvn eclipse:eclipse
5+
}
6+
7+
startSpringBoot() {
8+
echo "Which profile? (optional)"
9+
read defprofiles
10+
if [ "$defprofiles" = "" ]; then
11+
mvn spring-boot:run
12+
else
13+
mvn spring-boot:run -Dspring-boot.run.profiles=$defprofiles
14+
fi
15+
}
16+
17+
showGlobalSettings(){
18+
OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading global settings from')"
19+
echo ${OUTPUT:37}
20+
read -p "Open global settings? " -n 1 -r
21+
echo # (optional) move to a new line
22+
if [[ $REPLY =~ ^[Yy]$ ]]
23+
then
24+
vim ${OUTPUT:37}
25+
fi
26+
}
27+
28+
showLocalSettings() {
29+
OUTPUT="$(mvn -X | grep -F '[DEBUG] Reading user settings from')"
30+
echo ${OUTPUT:35}
31+
read -p "Open user settings? " -n 1 -r
32+
echo # (optional) move to a new line
33+
if [[ $REPLY =~ ^[Yy]$ ]]
34+
then
35+
vim ${OUTPUT:35}
36+
fi
37+
}
38+
39+
downLoadSources() {
40+
mvn dependency:sources
41+
mvn eclipse:eclipse -DdownloadSources=true
42+
}
43+

EasyKey.maven/maven.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
#####################################
4+
# EasyKey.maven utility main script #
5+
#####################################
6+
7+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
source "$script_dir/../shellmenu.sh"
9+
source "$script_dir/ezk-mavem-functions.sh"
10+
11+
menuInit "Super MAVEN Home"
12+
submenuHead "Maven:"
13+
menuItemClm a "Clean all eclipse" "mvnCleanEclipse" b "Maven analyze dependencies" "mvn dependency:analyze"
14+
menuItemClm c "Clean install force updates" "mvn clean install -U -DskipTests" d "To maven repo" tbd
15+
menuItemClm e "Show effective settings" "mvn help:effective-settings" f "Local repo location" "mvn help:evaluate -Dexpression=settings.localRepository | grep -v '\[INFO\]'"
16+
menuItemClm g "Show global settings" showGlobalSettings h "Show local settings" showLocalSettings
17+
menuItemClm i "Re-resolve project dependencies" "mvn dependency:purge-local-repository" j "List repositories" "mvn dependency:list-repositories"
18+
menuItemClm k "Download sources" downLoadSources l "Build with deps" "mvn clean compile assembly:single"
19+
submenuHead "Spring-Boot:"
20+
menuItem j "Start Spring Boot App" startSpringBoot
21+
startMenu

shellmenu.sh

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ menuHeadingBGClr="$clrBlue"
2626
submenuFGClr="$clrCyan"
2727
submenuBGClr="$clrBlack"
2828
delimiter=⊕
29+
formattedTop=""
30+
formattedBottom=""
31+
formattedMiddle=""
2932

3033
############################
3134
############################
@@ -45,7 +48,6 @@ menuInit () {
4548
actualsubmenuname="Your commands:"
4649
menudatamap=()
4750
${immediateMode} && printMenuHeading "$1"
48-
echo
4951
}
5052

5153
#################################################
@@ -102,8 +104,8 @@ menuItem () {
102104
#################################################
103105
menuItemClm () {
104106
clmLocalWidth=${globalClmWidth:=45}
105-
menudatamap+=("$1$delimiter$2$delimiter$3$delimiter$actualsubmenuname$delimiter$actualmenu$delimiter1")
106-
menudatamap+=("$4$delimiter$5$delimiter$6$delimiter$actualsubmenuname$delimiter$actualmenu$delimiter2")
107+
menudatamap+=("$1$delimiter$2$delimiter$3$delimiter$actualsubmenuname$delimiter$actualmenu${delimiter}1")
108+
menudatamap+=("$4$delimiter$5$delimiter$6$delimiter$actualsubmenuname$delimiter$actualmenu${delimiter}2")
107109
${immediateMode} && printMenuItemClm "$1" "$2" "$4" "$5"
108110
}
109111

@@ -115,6 +117,7 @@ menuItemClm () {
115117
#################################################
116118
startMenu() {
117119
while ${continuemenu:=true}; do
120+
clear
118121
generateMenu
119122
choice
120123
done
@@ -423,8 +426,12 @@ generateMenu () {
423426
OLD_IFS=$IFS
424427
local previoussubmenu previouscolumn submenucount;
425428
submenucount=0
426-
clear
429+
skipnext=false
427430
for ((index=0; index<${#menudatamap[@]}; index++)); do
431+
if [ "$skipnext" = "true" ]; then
432+
skipnext=false
433+
continue
434+
fi
428435
IFS="$delimiter" read -r key description action submenu menu column <<< "${menudatamap[index]}"
429436
IFS="$delimiter" read -r nextkey nextdescription nextaction nextsubmenu nextmenu nextcolumn <<< "${menudatamap[((index+1))]}"
430437
if [ "$index" -eq "0" ]; then printMenuHeading "$menu" && echo; fi
@@ -434,9 +441,10 @@ generateMenu () {
434441
submenucount=$((submenucount+1));
435442
fi
436443
if [ "$((nextcolumn))" -eq "$((column + 1))" ]; then
437-
printMenuItemClm "$key" "$description" "$action" "$nextkey" "$nextdescription" "$nextaction"
444+
printMenuItemClm "$key" "$description" "$nextkey" "$nextdescription"
445+
skipnext=true
438446
else
439-
printMenuItem "$key" "$description" "$action"
447+
printMenuItem "$key" "$description"
440448
fi
441449
previoussubmenu="$submenu"
442450
done
@@ -527,7 +535,7 @@ printMenuItem() {
527535
# The menu head to stdout
528536
#################################################
529537
printMenuHeading(){
530-
coloredLog "$1" "$menuHeadingFGClr" "$menuHeadingBGClr"
538+
draw_rounded_square "$1"
531539
}
532540

533541
#################################################
@@ -553,3 +561,59 @@ exitGently () {
553561
exit 1
554562
}
555563

564+
#################################################
565+
# Draw title graphic
566+
# Globals:
567+
# formattedTop - top line of graphic
568+
# formattedMiddle - middle line of graphic
569+
# formattedBottom - bottom line of graphic
570+
# tput colors
571+
# Arguments:
572+
# $1: menu head description
573+
# Outputs:
574+
# The menu head graphic to stdout
575+
#################################################
576+
draw_rounded_square() {
577+
578+
# Menu title cache
579+
if [ "$formattedTop" != "" ]; then
580+
echo -e "$formattedTop"
581+
echo -e "$formattedMiddle"
582+
echo -e "$formattedBottom"
583+
return
584+
fi
585+
586+
local text="$1"
587+
local width=${#text}
588+
589+
local horizontal_line=""
590+
local top_left_corner=""
591+
local top_right_corner=""
592+
local bottom_left_corner=""
593+
local bottom_right_corner=""
594+
local vertical_line=""
595+
596+
local border=""
597+
border+="$top_left_corner"
598+
for (( i=0; i<width+2; i++ )); do
599+
border+="$horizontal_line"
600+
done
601+
border+="$top_right_corner"
602+
603+
formattedTop=$(tput setaf $clrWhite)$(tput setab $clrBlue)$(tput bold)$border$(tput sgr0)
604+
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)
605+
606+
echo -e "$formattedTop"
607+
echo -e "$formattedMiddle"
608+
609+
border="$bottom_left_corner"
610+
for (( i=0; i<width+2; i++ )); do
611+
border+="$horizontal_line"
612+
done
613+
border+="$bottom_right_corner"
614+
615+
formattedBottom=$(tput setaf $clrWhite)$(tput setab $clrBlue)$(tput bold)$border$(tput sgr0)
616+
echo -e "$formattedBottom"
617+
618+
}
619+

0 commit comments

Comments
 (0)