go(utils): add promptMenu util function
This commit is contained in:
parent
4a5b954ad6
commit
5a6cd4ac16
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user