printers

package
v0.1.0-beta.202310190227 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HumanReadableTablePrinter

type HumanReadableTablePrinter struct {
}

Inspired by Kubernetes

func (HumanReadableTablePrinter) PrintResource

func (p HumanReadableTablePrinter) PrintResource(ctx context.Context, items types.PrintableResource, writer io.Writer) error

type JsonPrinter

type JsonPrinter struct {
}

func (JsonPrinter) PrintResource

func (p JsonPrinter) PrintResource(ctx context.Context, r types.PrintableResource, writer io.Writer) error

type ResourcePrinter

type ResourcePrinter interface {
	// PrintResource receives a runtime object, formats it and prints it to a writer.
	PrintResource(context.Context, types.PrintableResource, io.Writer) error
}

Inspired by Kubernetes

ResourcePrinter is an interface that knows how to print runtime objects.

func GetPrinter

func GetPrinter(cmd *cobra.Command) ResourcePrinter

type TablePrinter

type TablePrinter struct {
	Delegate ResourcePrinter
}

Inspired by Kubernetes TablePrinter decodes table objects into typed objects before delegating to another printer. Non-table types are simply passed through

func (TablePrinter) PrintResource

func (p TablePrinter) PrintResource(ctx context.Context, items types.PrintableResource, writer io.Writer) error

type YamlPrinter

type YamlPrinter struct {
}

Inspired by https://github.com/goccy/go-yaml/blob/master/cmd/ycat/ycat.go

func (YamlPrinter) PrintResource

func (px YamlPrinter) PrintResource(ctx context.Context, r types.PrintableResource, writer io.Writer) error

Jump to

Keyboard shortcuts

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