package main import ( "log" "ocl/portainer-devtool/configs" "ocl/portainer-devtool/tasks" "ocl/portainer-devtool/utils" "strconv" ) func main() { config, err := configs.GetConfig() if err != nil { log.Fatalln(err) } config.Summarize() // Init tasks taskItems := []tasks.Tasker{ tasks.NewGenerateJwtTokenTask(config), } for { printMainMenu := func() { utils.PrintMenu("Which repository of action do you want operate:", taskItems) // utils.MenuPrint("Which repository or action do you want to operate:", ` // 1. Portainer EE Repository // 2. Portainer CE Repository // 3. Portainer Agent Repository // 4. Others // 5. Quit`) } option := utils.SelectMenuItem(printMainMenu) index, err := strconv.Atoi(option) if err != nil { log.Printf("please type the option number\n") continue } if index < 1 || index > len(taskItems) { log.Printf("no such option %s, please select again\n", option) continue } err = taskItems[index-1].Execute() if err != nil { log.Fatalln(err) } } }