printer

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 3 Imported by: ? 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 printer renders cinc command output in a selectable format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format identifies an output rendering.

const (
	// FormatHuman is human-readable plain text.
	FormatHuman Format = "human"
	// FormatJSON is machine-readable JSON.
	FormatJSON Format = "json"
)

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat converts a format name into a Format, rejecting unknown names.

type Printer

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

Printer renders command results to a writer in a fixed format.

func New

func New(w io.Writer, format Format) *Printer

New returns a Printer that writes to w in the given format.

func (*Printer) List

func (p *Printer) List(items []string) error

List renders a flat list of string items.

func (*Printer) Value

func (p *Printer) Value(v any) error

Value renders an arbitrary structured command result. For server-object payloads (roles, environments, clients, …) the human format is pretty- printed JSON: that's already what `knife show` emits, it stays grepable, and inventing per-type human renderers would diverge from how Chef admins read these objects today.

Jump to

Keyboard shortcuts

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