fix: route result output through Config.Output, not os.Stdout

mark.Run and ProcessFile were writing directly to os.Stdout via
fmt.Println, which is a surprising side-effect for library callers.

Add Config.Output io.Writer for callers to provide their own sink.
When nil the helper falls back to io.Discard, so library embedders
that do not set Output receive no implicit stdout writes. The CLI
layer sets Output: os.Stdout to preserve existing behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Manuel Rüger
2026-03-12 23:05:28 +01:00
parent 06c3afef25
commit 4e3b90c03c
2 changed files with 19 additions and 2 deletions

View File

@@ -83,6 +83,8 @@ func RunMark(ctx context.Context, cmd *cli.Command) error {
Features: cmd.StringSlice("features"),
ImageAlign: cmd.String("image-align"),
IncludePath: cmd.String("include-path"),
Output: os.Stdout,
}
return mark.Run(config)