printer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetBaseHumanReadablePrinter

func SetBaseHumanReadablePrinter(name string, headers []string, argsTemplate []string)

func SetHumanReadablePrinter

func SetHumanReadablePrinter(name string, hPrinter HumanReadablePrinter)

Types

type BaseHumanReadablePrinter

type BaseHumanReadablePrinter struct {
	Headers     []string
	RowTemplate []*template.Template
}

func NewGoTemplateBasePrinter

func NewGoTemplateBasePrinter(templateStr string) (*BaseHumanReadablePrinter, error)

func (*BaseHumanReadablePrinter) GetHeaders

func (h *BaseHumanReadablePrinter) GetHeaders() []interface{}

func (*BaseHumanReadablePrinter) GetRow

func (h *BaseHumanReadablePrinter) GetRow(i interface{}) []interface{}

type HumanReadablePrinter

type HumanReadablePrinter interface {
	GetHeaders() []interface{}
	GetRow(interface{}) []interface{}
}

func GetHumanReadablePrinter

func GetHumanReadablePrinter(name string) HumanReadablePrinter

type JsonPrinter

type JsonPrinter struct{}

func (*JsonPrinter) Print

func (p *JsonPrinter) Print(w io.Writer, obj api.Spec) error

type LinePrinter

type LinePrinter struct {
	Printer HumanReadablePrinter
}

func NewGoTemplatePrinter

func NewGoTemplatePrinter(templateStr string) (*LinePrinter, error)

func NewLinePrinter

func NewLinePrinter(cmdName string) (*LinePrinter, error)

func (*LinePrinter) Print

func (p *LinePrinter) Print(w io.Writer, obj api.Spec) error

type Printer

type Printer interface {
	Print(w io.Writer, obj api.Spec) error
}

func GetPrinter

func GetPrinter(cmdName, outType string) (Printer, error)

type YAMLPrinter

type YAMLPrinter struct{}

func (*YAMLPrinter) Print

func (p *YAMLPrinter) Print(w io.Writer, obj api.Spec) error

Jump to

Keyboard shortcuts

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