portainer-devtool/go/main.go

54 lines
863 B
Go

package main
import (
"log"
"ocl/portainer-devtool/repositories"
"ocl/portainer-devtool/utils"
"os"
)
const (
MENU_OPTION_EE_REPO int = iota + 1
MENU_OPTION_CE_REPO
MENU_OPTION_AGENT_REPO
MENU_OPTION_OTHERS
MENU_OPTION_QUIT
)
func main() {
for {
printMainMenu := func() {
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.PromptMenu(printMainMenu)
var action repositories.Actioner
switch option {
case MENU_OPTION_EE_REPO:
action = repositories.NewPortainerEERepository()
case MENU_OPTION_CE_REPO:
case MENU_OPTION_AGENT_REPO:
case MENU_OPTION_OTHERS:
case MENU_OPTION_QUIT:
os.Exit(0)
}
err := action.Execute()
if err != nil {
log.Fatalln(err)
}
}
}