ente/main.go
2023-10-18 12:22:28 +05:30

33 lines
538 B
Go

package main
import (
"cli-go/cmd"
"cli-go/internal/api"
"cli-go/pkg"
"cli-go/pkg/secrets"
)
func main() {
db, err := pkg.GetDB("ente-cli.db")
if err != nil {
panic(err)
}
ctrl := pkg.ClICtrl{
Client: api.NewClient(api.Params{
Debug: false,
//Host: "http://localhost:8080",
}),
DB: db,
KeyHolder: secrets.NewKeyHolder(secrets.GetOrCreateClISecret()),
}
err = ctrl.Init()
if err != nil {
panic(err)
}
defer func() {
if err := db.Close(); err != nil {
panic(err)
}
}()
cmd.Execute(&ctrl)
}