diff --git a/go/utils/print.go b/go/utils/print.go index 7e24429..7354135 100644 --- a/go/utils/print.go +++ b/go/utils/print.go @@ -41,8 +41,10 @@ func InputPrint(message string) { fmt.Println(colorYellow, message, colorReset) } -func MenuPrint() { - InputPrint("Which repository or action do you want to operate:") +func MenuPrint(question, menu string) { + if question != "" { + InputPrint(fmt.Sprintf("[%s]", question)) + } // menu := ` // 1. Build Portainer EE/CE All @@ -56,10 +58,5 @@ func MenuPrint() { // 9. Cleanup Temporary Volume // ` - menu := `1. Portainer EE Repository - 2. Portainer CE Repository - 3. Portainer Agent Repository - 4. Others` - fmt.Println(colorCyan, menu, colorReset) } diff --git a/go/utils/prompt.go b/go/utils/prompt.go index 5d7465d..8fd6eed 100644 --- a/go/utils/prompt.go +++ b/go/utils/prompt.go @@ -14,6 +14,14 @@ func PromptContinue() bool { return false } +func PromptMenu(listMenu func()) int { + listMenu() + + var option int + fmt.Scanf("%d", &option) + return option +} + func prompt(question string) string { fmt.Printf("%s %s :%s", colorYellow, question, colorReset) var ret string