#`Frontend.withPostRun(hook func(*DB)` ?
1 messages · Page 1 of 1 (latest)
Should have started a thread a while ago..
@solar siren looking at cmd/dagger/checks.go I'm not sure where to call Frontend.withPostRun. Straight up hook into the global var before even calling withEngine?
RunE: func(cmd *cobra.Command, args []string) error {
// BOOM, guns blazing
Frontend = Frontend.WithPostRun(printChecks)
return withEngine(cmd.Context(), client.Params{}, func(ctx context.Context, engineClient *client.Client) error {
dag := engineClient.Dagger()
mod, err := loadModule(ctx, dag)
if err != nil {
return err
}
var checks *dagger.CheckGroup
if len(args) > 0 {
checks = mod.Checks(dagger.ModuleChecksOpts{Include: args})
} else {
checks = mod.Checks()
}
if checksListMode {
return listChecks(ctx, checks, cmd)
}
return runChecks(ctx, checks, cmd)
})
},
sure, yeah if it's just setup that seems fine
Otherwise in client Params?
re: SetClient, that was added recently for the t hotkey to open a terminal, could probably be factored differently
nah that's all closer to engine workings than UI
you might want it inside withEngine if you want it to be able to make use of the client, but i think your idea is by this point all the data should be loaded already
@solar siren I noticed that frontendPretty.FinalRender already writes to raw os.Stderr. So I'll do the same, assuming it's safe to do so post-run