Documentation
¶
Overview ¶
Package output renders results and errors as text or JSON and defines exit codes.
Index ¶
Constants ¶
View Source
const ( ExitOK = 0 ExitUnexpected = 1 ExitUsage = 2 ExitAuth = 3 ExitConflict = 4 ExitNotFound = 5 ExitForbidden = 6 ExitNetwork = 7 )
Variables ¶
This section is empty.
Functions ¶
func Quote ¶ added in v0.3.0
Quote returns s as is, or Go-quoted when it has an unsafe rune: text that often comes from the server (an error cause, a name) then stays on one line and shows what it carries.
func UnsafeRune ¶ added in v0.3.0
UnsafeRune is a rune that can break or disguise a line of text output: controls, line and paragraph separators, and format characters such as bidi overrides.
func WriteError ¶
WriteError renders the error envelope.
func WriteFields ¶
WriteFields prints aligned "key: value" lines for text mode.
Types ¶
type Error ¶
type Error struct {
Code string `json:"code"`
Source string `json:"source,omitempty"`
Stage string `json:"stage,omitempty"`
Cause string `json:"cause,omitempty"`
Recovery string `json:"recovery,omitempty"`
Exit int `json:"-"`
}
Error is the stable error envelope. Cause must never contain secrets.
Click to show internal directories.
Click to hide internal directories.