output

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Names []string
View Source
var Outputs = []Output{
	Yaml,
	Table,
}
View Source
var Table = &table{}
View Source
var Yaml = &yaml{}

Functions

func MarshalYaml

func MarshalYaml(v any) (string, error)

Types

type Output

type Output interface {
	// GetName returns the name of the output format, will be used by the CLI to identify the output format.
	GetName() string
	// AsTable true if the kubernetes request should be made with the `application/json;as=Table;v=0.1` header.
	AsTable() bool
	// PrintObj prints the given object as a string.
	PrintObj(obj runtime.Unstructured) (string, error)
	// PrintObjStructured prints the given object and also extracts structured data.
	PrintObjStructured(obj runtime.Unstructured) (*PrintResult, error)
}

func FromString

func FromString(name string) Output

type PrintResult added in v0.0.60

type PrintResult struct {
	// Text is the human-readable formatted output (YAML or Table).
	Text string
	// Structured is an optional JSON-serializable value extracted from the object.
	// For Table output, this is []map[string]any with column headers as keys.
	// For YAML output, this is the cleaned-up object items as []map[string]any (lists)
	// or a single map[string]any (individual objects).
	Structured any
}

PrintResult holds both the text representation and optional structured data extracted from a Kubernetes object.

Jump to

Keyboard shortcuts

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