output

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API

func API(message string, cause error) error

func Auth

func Auth(message string) error

func ExitCode

func ExitCode(err error) int

func Forbidden

func Forbidden(message string) error

func Network

func Network(err error) error

func NotFound

func NotFound(resource, identifier string) error

func Usage

func Usage(message, hint string) error

func WithData

func WithData(err error, data any) error

func WithRenderedData

func WithRenderedData(err error, data any) error

WithRenderedData attaches structured error data and uses its human rendering as the complete error output in human mode. JSON modes retain the standard error envelope and include the data under the data key.

func WriteJSON

func WriteJSON(w io.Writer, value any) error

WriteJSON writes the CLI's safe, stable structured representation. It is exported for the small number of machine-readable command surfaces that do not pass through Success or Error.

Types

type HumanRenderable

type HumanRenderable interface {
	HumanText() string
}

type MarkdownRenderable

type MarkdownRenderable interface {
	MarkdownText() string
}

type Options

type Options struct {
	JSON      bool
	Markdown  bool
	Agent     bool
	JQ        string
	Writer    io.Writer
	ErrWriter io.Writer
}

type RichError

type RichError struct {
	Base *baseoutput.Error
	Data any
}

func (*RichError) Error

func (e *RichError) Error() string

func (*RichError) ErrorData

func (e *RichError) ErrorData() any

func (*RichError) Unwrap

func (e *RichError) Unwrap() error

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Writer

func (*Writer) Error

func (w *Writer) Error(err error) error

func (*Writer) Success

func (w *Writer) Success(data any, summary string, breadcrumbs []baseoutput.Breadcrumb, meta map[string]any) error

Jump to

Keyboard shortcuts

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