Create Golang version devtool #7
@ -1,6 +1,9 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"ocl/portainer-devtool/tasks"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
colorReset string = "\033[0m"
|
colorReset string = "\033[0m"
|
||||||
@ -41,6 +44,20 @@ func InputPrint(message string) {
|
|||||||
fmt.Println(colorYellow, message, colorReset)
|
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) {
|
func MenuPrint(question, menu string) {
|
||||||
if question != "" {
|
if question != "" {
|
||||||
InputPrint(fmt.Sprintf("[%s]", question))
|
InputPrint(fmt.Sprintf("[%s]", question))
|
||||||
|
Loading…
Reference in New Issue
Block a user