2026-04-26 13:03:07 -05:00
|
|
|
package builtin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"gitea.maximumdirect.net/eric/seriatim/internal/config"
|
2026-05-24 14:57:12 +00:00
|
|
|
"gitea.maximumdirect.net/eric/seriatim/internal/jsonfile"
|
2026-04-26 13:03:07 -05:00
|
|
|
"gitea.maximumdirect.net/eric/seriatim/internal/report"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type jsonOutputWriter struct{}
|
|
|
|
|
|
|
|
|
|
func (jsonOutputWriter) Name() string {
|
|
|
|
|
return "json"
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 14:39:00 -05:00
|
|
|
func (jsonOutputWriter) Write(ctx context.Context, out any, rpt report.Report, cfg config.Config) ([]report.Event, error) {
|
2026-04-26 13:03:07 -05:00
|
|
|
if err := ctx.Err(); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-24 14:57:12 +00:00
|
|
|
if err := jsonfile.Write(cfg.OutputFile, out); err != nil {
|
2026-04-26 13:03:07 -05:00
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return []report.Event{
|
2026-04-27 21:27:19 -05:00
|
|
|
report.Info("output", "json", "wrote transcript JSON"),
|
2026-04-26 13:03:07 -05:00
|
|
|
}, nil
|
|
|
|
|
}
|