Documentation
¶
Overview ¶
Package output implements szwm's stdout contract.
In json mode stdout carries exactly one JSON document per run, success or failure. In ndjson mode each item is one line and the last line is a summary. A failure also prints a one-line message to stderr, so it stays visible when stdout is piped into another tool.
Index ¶
Constants ¶
const SchemaVersion = "1"
SchemaVersion versions the envelope, error codes and exit codes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Envelope ¶
type Envelope struct {
SchemaVersion string `json:"schema_version"`
OK bool `json:"ok"`
Command string `json:"command"`
Data any `json:"data,omitempty"`
Error *apperr.Error `json:"error,omitempty"`
Meta Meta `json:"meta"`
}
Envelope wraps every JSON result.
type Meta ¶
type Meta struct {
Version string `json:"szwm_version"`
Profile string `json:"profile,omitempty"`
Site string `json:"site,omitempty"`
DurationMS int64 `json:"duration_ms"`
Requests int64 `json:"requests"`
Retries int64 `json:"retries"`
Truncated bool `json:"truncated,omitempty"`
Hints []string `json:"hints,omitempty"`
Warnings []string `json:"warnings,omitempty"`
UntrustedFields []string `json:"untrusted_fields,omitempty"`
}
Meta describes how a result was produced.