Skip to content
go-libfossil Artifact [a41428f83a]
Login

Artifact [a41428f83a]

Artifact a41428f83ace36c2dd76b02635e47f14b118c4c417863d785c0de53e543119b9:


package cli

import (
	"encoding/json"
	"os"
)

// writeJSON prints v to stdout as one line of JSON. The shapes it prints are
// the machine interface of snapshot, log and diff, documented in
// docs/site/content/docs/guides/cli-embedding.md; a field is never renamed or
// removed, only added.
func writeJSON(v any) error {
	enc := json.NewEncoder(os.Stdout)
	enc.SetEscapeHTML(false)
	return enc.Encode(v)
}