render

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Table = "table"
	JSON  = "json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

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

Renderer is the only thing that writes command results to stdout. Commands return values; the format is decided here, which is what makes --output json work everywhere instead of command by command.

func New

func New(out io.Writer, format string) *Renderer

func (*Renderer) Message

func (r *Renderer) Message(format string, args ...any) error

Message reports an outcome that carries no data of its own.

func (*Renderer) MessageWith added in v0.15.0

func (r *Renderer) MessageWith(extra map[string]any, format string, args ...any) error

MessageWith is Message for an outcome with a little data: extra goes into the JSON document next to the message, and the table output is the line alone.

func (*Renderer) Render

func (r *Renderer) Render(v any) error

Render writes v as a table or as JSON. For tables, v must be a struct or a slice of structs; the columns are the fields tagged `table:"HEADER"`, in declaration order.

Jump to

Keyboard shortcuts

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