output

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 4 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

Overview

Package output renders one result either for a human or as versioned JSON.

Index

Constants

This section is empty.

Variables

View Source
var LogLevels = []string{"error", "warn", "info", "debug"}

LogLevels are the internal log levels, most severe first.

Functions

func List

func List(values []string) string

List joins values or says none.

func YesNo

func YesNo(b bool) string

YesNo renders a boolean.

Types

type Printer

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

Printer writes human-readable lines.

func (Printer) Line

func (p Printer) Line(format string, args ...any)

Line writes one formatted line.

func (Printer) Section

func (p Printer) Section(title string, lines ...string)

Section writes a heading followed by indented lines.

type Renderer

type Renderer struct {
	Out     io.Writer
	Err     io.Writer
	JSON    bool
	Verbose bool
	// LogLevel is the least severe level written by Log; empty means warn.
	LogLevel string
}

Renderer writes results.

func (Renderer) Detail

func (r Renderer) Detail(text string)

Detail writes a line only in verbose mode.

func (Renderer) Emit

func (r Renderer) Emit(v any, human func(p Printer)) error

Emit writes v as JSON when JSON output was requested, otherwise calls human with a line writer.

func (Renderer) Info

func (r Renderer) Info(format string, args ...any)

Info writes a progress line for humans; silent in JSON mode.

func (Renderer) Log

func (r Renderer) Log(level, format string, args ...any)

Log writes an internal log line to stderr when level is at least as severe as LogLevel. Callers pass operation names and results only, never secrets.

Jump to

Keyboard shortcuts

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