printer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedOutputFormatsForHelp

func AllowedOutputFormatsForHelp() []string

func Describe

func Describe(w io.Writer, pairs []*DescriberKV)

Describe writes the key-value paris to the writer. It handles things like properly writing special data types like Tables.

Types

type DefaultEventFetcher

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

func NewDefaultEventFetcher

func NewDefaultEventFetcher(factory common.Factory) *DefaultEventFetcher

func (DefaultEventFetcher) FetchEventsFor

func (d DefaultEventFetcher) FetchEventsFor(object client.Object) ([]*corev1.Event, error)

type DescriberKV

type DescriberKV struct {
	Key   string
	Value any
}

DescriberKV stores key-value pairs that are used with Describing a resource.

type DescriptionPrinter

type DescriptionPrinter struct {
	PrinterOptions
	// contains filtered or unexported fields
}

func (*DescriptionPrinter) Flush

func (p *DescriptionPrinter) Flush(io.Writer) error

func (*DescriptionPrinter) PrintNode

func (p *DescriptionPrinter) PrintNode(node *topology.Node, w io.Writer) error

type JSONPrinter

type JSONPrinter struct {
	Delegate *printers.OmitManagedFieldsPrinter
}

func NewJSONPrinter

func NewJSONPrinter() *JSONPrinter

func (*JSONPrinter) Flush

func (p *JSONPrinter) Flush(io.Writer) error

func (*JSONPrinter) PrintNode

func (p *JSONPrinter) PrintNode(node *topology.Node, w io.Writer) error

type OutputFormat

type OutputFormat string
const (
	OutputFormatWide  OutputFormat = "wide"
	OutputFormatJSON  OutputFormat = "json"
	OutputFormatYAML  OutputFormat = "yaml"
	OutputFormatGraph OutputFormat = "graph"
	OutputFormatTable OutputFormat = ""
)

func ValidateAndReturnOutputFormat

func ValidateAndReturnOutputFormat(format string) (OutputFormat, error)

type Printer

type Printer interface {
	PrintNode(node *topology.Node, w io.Writer) error
	Flush(io.Writer) error
}

func NewPrinter

func NewPrinter(options PrinterOptions) Printer

type PrinterOptions

type PrinterOptions struct {
	OutputFormat OutputFormat
	Description  bool
	Clock        clock.Clock
	EventFetcher eventFetcher
}

type Table

type Table struct {
	ColumnNames []string
	Rows        [][]string
	// UseSeparator indicates whether the header row and data rows will be
	// separated through a separator.
	UseSeparator bool
}

func (*Table) Write

func (t *Table) Write(w io.Writer, indent int) error

Write will write a formatted table to the writer. indent controls the number of spaces at the beginning of each row.

type TablePrinter

type TablePrinter struct {
	PrinterOptions
	// contains filtered or unexported fields
}

func (*TablePrinter) Flush

func (p *TablePrinter) Flush(w io.Writer) error

func (*TablePrinter) PrintNode

func (p *TablePrinter) PrintNode(node *topology.Node, w io.Writer) error

type YAMLPrinter

type YAMLPrinter struct {
	Delegate *printers.OmitManagedFieldsPrinter
}

func NewYAMLPrinter

func NewYAMLPrinter() *YAMLPrinter

func (*YAMLPrinter) Flush

func (p *YAMLPrinter) Flush(io.Writer) error

func (*YAMLPrinter) PrintNode

func (p *YAMLPrinter) PrintNode(node *topology.Node, w io.Writer) error

Jump to

Keyboard shortcuts

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