Documentation
¶
Overview ¶
Package output contains output contracts and exit code helpers.
Index ¶
- Constants
- func AuthError(message string) error
- func Code(err error) int
- func FromHTTPStatus(status int) int
- func NetworkError(message string) error
- func NotFoundError(message string) error
- func ServerError(message string) error
- func UsageError(message string) error
- func ValidationError(message string) error
- type ExitError
- type Format
- type Renderer
Constants ¶
View Source
const ( // ExitOK indicates successful command execution. ExitOK = 0 // ExitGeneric indicates an unclassified command failure. ExitGeneric = 1 // ExitUsage indicates invalid CLI usage. ExitUsage = 2 // ExitAuth indicates authentication or authorization failures. ExitAuth = 10 // ExitValidation indicates invalid input or semantic validation errors. ExitValidation = 11 // ExitNotFound indicates that the requested resource does not exist. ExitNotFound = 12 // ExitNetwork indicates transport-level failures such as timeouts or DNS/connectivity issues. ExitNetwork = 13 // ExitServer indicates server-side failures. ExitServer = 14 )
Variables ¶
This section is empty.
Functions ¶
func FromHTTPStatus ¶
FromHTTPStatus maps an HTTP status code to a stable CLI exit code.
func NotFoundError ¶
NotFoundError wraps a missing-resource failure.
func UsageError ¶
UsageError wraps a usage error with the standard exit code.
func ValidationError ¶
ValidationError wraps a client input validation failure.
Types ¶
type ExitError ¶
ExitError carries a stable process exit code together with an error.
type Format ¶
type Format string
Format selects output rendering mode.
func ParseFormat ¶
ParseFormat validates and parses output format.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer is a small abstraction for stable stdout rendering.
func NewRenderer ¶
NewRenderer creates a new renderer.
func (*Renderer) PrintTable ¶
PrintTable prints tabular data in human/table mode.
func (*Renderer) PrintValue ¶
PrintValue prints a generic value according to the selected format.
Click to show internal directories.
Click to hide internal directories.