printers

package
v1.6.11 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoTemplatePrinter

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

func NewGoTemplatePrinter

func NewGoTemplatePrinter(tmpl []byte) (*GoTemplatePrinter, error)

func (*GoTemplatePrinter) AllowMissingKeys

func (p *GoTemplatePrinter) AllowMissingKeys(allow bool)

AllowMissingKeys tells the template engine if missing keys are allowed.

func (*GoTemplatePrinter) Print

func (p *GoTemplatePrinter) Print(ios *iostreams.IOStreams, data interface{}) error

Print formats the interface with the Go Template.

type JSONPathPrinter

type JSONPathPrinter struct {
	JSONPath *jsonpath.JSONPath
	// contains filtered or unexported fields
}

func NewJSONPathPrinter

func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error)

func (*JSONPathPrinter) AllowMissingKeys

func (j *JSONPathPrinter) AllowMissingKeys(allow bool)

AllowMissingKeys tells the template engine if missing keys are allowed.

func (*JSONPathPrinter) EnableJSONOutput

func (j *JSONPathPrinter) EnableJSONOutput(enable bool)

EnableJSONOutput enables JSON output.

func (*JSONPathPrinter) Print

func (j *JSONPathPrinter) Print(ios *iostreams.IOStreams, data interface{}) error

Print formats the interface with the JSONPath Template.

type JSONPrinter

type JSONPrinter struct{}

func (*JSONPrinter) Print

func (p *JSONPrinter) Print(ios *iostreams.IOStreams, data interface{}) error

Print is an implementation of Printer.Print which simply writes the object to the Writer.

type JSONPrinterOptions

type JSONPrinterOptions struct {
	Template string
}

type PrintOptions

type PrintOptions struct {
	NoHeaders    bool
	ColumnLabels []string
}

PrintOptions struct defines a struct for various print options

type Printer

type Printer interface {
	// Print receives an interface, formats it and prints it.
	Print(*iostreams.IOStreams, interface{}) error
}

Printer is an interface that knows how to print interfaces.

type PrinterFunc

type PrinterFunc func(interface{}, *iostreams.IOStreams) error

PrinterFunc is a function that can print interfaces

func (PrinterFunc) Print

func (fn PrinterFunc) Print(obj interface{}, io *iostreams.IOStreams) error

Print implements Printer

type TablePrinter

type TablePrinter interface {
	IsTTY() bool
	AddField(string, func(int, string) string, func(string) string)
	EndRow()
	Render() error
}

func NewTablePrinter

func NewTablePrinter(io *iostreams.IOStreams) TablePrinter

func NewTablePrinterWithOptions

func NewTablePrinterWithOptions(io *iostreams.IOStreams, opts TablePrinterOptions) TablePrinter

type TablePrinterOptions

type TablePrinterOptions struct {
	IsTTY bool
}

Jump to

Keyboard shortcuts

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