(hotfix) make sure app is initialized only when we need it

This commit is contained in:
Robin Olsen
2026-03-02 11:41:57 +01:00
parent 1baf6c7ff4
commit cb10aeff6b
3 changed files with 95 additions and 11 deletions

View File

@@ -5,24 +5,20 @@ import (
"github.com/LazyBachelor/LazyPM/internal/app"
issues "github.com/LazyBachelor/LazyPM/internal/commands/issues"
survey "github.com/LazyBachelor/LazyPM/internal/commands/survey"
"github.com/charmbracelet/fang"
)
var App *app.App
var appCleanup func()
var RootCmd = issues.RootCmd
func main() {
ctx := context.Background()
app, cleanup, err := initializeServices(ctx)
if err != nil {
return
}
defer cleanup()
App = app
survey.SetApp(App)
issues.SetApp(App)
defer func() {
if appCleanup != nil {
appCleanup()
}
}()
if err := fang.Execute(ctx, RootCmd,
fang.WithColorSchemeFunc(fang.AnsiColorScheme)); err != nil {