40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"gitea.maximumdirect.net/eric/seriatim/internal/config"
|
|
"gitea.maximumdirect.net/eric/seriatim/internal/render"
|
|
)
|
|
|
|
func newRenderCommand() *cobra.Command {
|
|
opts := config.RenderOptions{
|
|
Title: config.DefaultRenderTitle,
|
|
IncludeTimestamps: true,
|
|
}
|
|
|
|
cmd := &cobra.Command{
|
|
Use: "render",
|
|
Short: "Render a seriatim transcript artifact into human-readable output",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cfg, err := config.NewRenderConfig(opts)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return render.Run(cmd.Context(), cfg)
|
|
},
|
|
}
|
|
|
|
flags := cmd.Flags()
|
|
flags.StringVar(&opts.InputFile, "input-file", "", "input seriatim transcript artifact JSON file")
|
|
flags.StringVar(&opts.OutputFile, "output-file", "", "rendered output file path")
|
|
flags.StringVar(&opts.Format, "format", "", "output format (markdown)")
|
|
flags.StringVar(&opts.Title, "title", config.DefaultRenderTitle, "document title")
|
|
flags.BoolVar(&opts.IncludeTimestamps, "include-timestamps", true, "include segment timestamps")
|
|
flags.BoolVar(&opts.IncludeSegmentIDs, "include-segment-ids", false, "include segment IDs")
|
|
flags.BoolVar(&opts.IncludeMetadata, "include-metadata", false, "include artifact metadata")
|
|
|
|
return cmd
|
|
}
|