out

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretty

func Pretty(w io.Writer, format string, args ...any)

Pretty prints a short human line to w. Used by individual commands as their pretty-mode summary.

func WriteError

func WriteError(w io.Writer, pretty bool, product string, err error) error

WriteError writes an error envelope to w. Always emits JSON even in pretty mode — easier for LLM callers to diagnose regardless of flag.

func WriteSuccess

func WriteSuccess(w io.Writer, pretty bool, product string, data any) error

WriteSuccess writes a success envelope. When pretty is true, the caller is responsible for having written the human summary first; this function emits nothing in that case to avoid duplicating the payload.

Types

type Envelope

type Envelope struct {
	Success bool           `json:"success"`
	Product string         `json:"product,omitempty"`
	Data    any            `json:"data,omitempty"`
	Error   *EnvelopeError `json:"error,omitempty"`
}

type EnvelopeError

type EnvelopeError struct {
	Code       string `json:"code,omitempty"`
	Message    string `json:"message"`
	HTTPStatus int    `json:"http_status,omitempty"`
	Hint       string `json:"hint,omitempty"`
	Retryable  bool   `json:"retryable,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL