2023-09-12 10:15:41 +00:00
|
|
|
package main
|
|
|
|
|
2023-09-13 08:51:05 +00:00
|
|
|
import (
|
|
|
|
"cli-go/cmd"
|
|
|
|
"cli-go/internal/api"
|
|
|
|
"cli-go/pkg"
|
|
|
|
)
|
|
|
|
|
2023-09-12 10:15:41 +00:00
|
|
|
func main() {
|
2023-09-13 08:51:05 +00:00
|
|
|
db, err := pkg.GetDB("ente-cli.db")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
ctrl := pkg.ClICtrl{
|
2023-09-15 10:55:29 +00:00
|
|
|
Client: api.NewClient(api.Params{
|
|
|
|
Debug: false,
|
|
|
|
Host: "http://localhost:8080",
|
|
|
|
}),
|
2023-09-22 13:37:12 +00:00
|
|
|
DB: db,
|
|
|
|
CliKey: pkg.GetOrCreateClISecret(),
|
2023-09-15 10:55:29 +00:00
|
|
|
}
|
|
|
|
err = ctrl.Init()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
2023-09-13 08:51:05 +00:00
|
|
|
}
|
|
|
|
defer func() {
|
|
|
|
if err := db.Close(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
cmd.Execute(&ctrl)
|
2023-09-22 13:47:24 +00:00
|
|
|
//ctrl.StartSync()
|
2023-09-12 10:15:41 +00:00
|
|
|
}
|