printer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package printer provides functions for rendering resources.Resource collections into various formats for outputting to the terminal or command pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByName

func ByName(name string) (func(io.Writer, []resources.Resource) error, error)

ByName returns a printer function from the given name. If no name is given and the program output is being redirected or piped to a consumer process, hen default to the YAML printer. Additionally, if no name is given and the program output is being sent directly to the terminal, then instead default to the Table printer.

func JSON

func JSON(w io.Writer, results []resources.Resource) error

JSON prints each given resources.Resource as a single-line json document. Intended to be used when piping to a script that could e.g. `read` each resource in a loop.

func Name

func Name(w io.Writer, results []resources.Resource) error

Name prints each given resources.Resource in "name" format similar to kubectl.

func Path

func Path(w io.Writer, results []resources.Resource) error

Path prints the file path of each given resources.Resource.

func References

func References(w io.Writer, results []resources.Resource) error

References prints the names of all resources referenced by each given resources.Resource.

func Selector added in v0.4.0

func Selector(w io.Writer, items []resources.Resource) error

Selector prints each given resources.Resource with the resource name and a matching label selector.

func Table

func Table(w io.Writer, items []resources.Resource) error

Table prints each given resources.Resource as a row in a formatted table.

func YAML

func YAML(w io.Writer, items []resources.Resource) error

YAML prints each given resources.Resource as a stream of yaml documents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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