Skip to content
go-libfossil Artifact [dd120069d5]
Login

Artifact [dd120069d5]

Artifact dd120069d53867b77b7356a11af6caa60858957a18bc917c0494bcf1c1a5f446:


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/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)
}