Create Golang version devtool #7

Merged
oscar merged 25 commits from oscar-next into master 2022-12-29 20:34:22 +11:00
Showing only changes of commit 9c56ec0d85 - Show all commits

View File

@ -1,6 +1,9 @@
package utils
import "fmt"
import (
"fmt"
"ocl/portainer-devtool/tasks"
)
const (
colorReset string = "\033[0m"
@ -41,6 +44,20 @@ func InputPrint(message string) {
fmt.Println(colorYellow, message, colorReset)
}
func PrintMenu(question string, tasks []tasks.Tasker) {
if question != "" {
InputPrint(fmt.Sprintf("[%s]", question))
}
menuContent := ""
for i, task := range tasks {
menuContent += fmt.Sprintf("%d. %s\n", i+1, task.String())
}
fmt.Println(colorCyan, menuContent, colorReset)
}
func MenuPrint(question, menu string) {
if question != "" {
InputPrint(fmt.Sprintf("[%s]", question))