Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonPrinter ¶
func NewJsonPrinter ¶
func NewJsonPrinter[T any]() (*JsonPrinter[T], error)
func (JsonPrinter[T]) PrintResource ¶
func (p JsonPrinter[T]) PrintResource(ctx context.Context, r types.PrintableResource[T], writer io.Writer) error
type ResourcePrinter ¶
type ResourcePrinter[T any] interface { // PrintResource receives a runtime object, formats it and prints it to a writer. PrintResource(context.Context, types.PrintableResource[T], io.Writer) error }
Inspired by Kubernetes
ResourcePrinter is an interface that knows how to print runtime objects.
func GetPrinter ¶
func GetPrinter[T any](cmd *cobra.Command) (ResourcePrinter[T], error)
type StringPrinter ¶
type StringPrinter[T any] struct { Sanitizer *sanitize.Sanitizer // contains filtered or unexported fields }
func NewStringPrinter ¶
func NewStringPrinter[T any]() (*StringPrinter[T], error)
func (StringPrinter[T]) PrintResource ¶
func (p StringPrinter[T]) PrintResource(_ context.Context, r types.PrintableResource[T], writer io.Writer) error
type TablePrinter ¶
Inspired by Kubernetes TablePrinter decodes table objects into typed objects before delegating to another printer. Non-table types are simply passed through
func NewTablePrinter ¶
func NewTablePrinter[T any]() (*TablePrinter[T], error)
func (TablePrinter[T]) PrintResource ¶
func (p TablePrinter[T]) PrintResource(_ context.Context, items types.PrintableResource[T], writer io.Writer) error
func (TablePrinter[T]) PrintTable ¶
type YamlPrinter ¶
Inspired by https://github.com/goccy/go-yaml/blob/master/cmd/ycat/ycat.go
func NewYamlPrinter ¶
func NewYamlPrinter[T any]() (*YamlPrinter[T], error)
func (YamlPrinter[T]) PrintResource ¶
func (px YamlPrinter[T]) PrintResource(ctx context.Context, r types.PrintableResource[T], writer io.Writer) error
Click to show internal directories.
Click to hide internal directories.