printer

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONToYAML

func JSONToYAML(j []byte) ([]byte, error)

JSONToYAML Converts JSON to YAML.

Types

type JSONPrinter

type JSONPrinter struct{}

func (*JSONPrinter) PrintObj

func (p *JSONPrinter) PrintObj(obj interface{}, w io.Writer) error

type JSONYamlPrintFlags

type JSONYamlPrintFlags struct {
}

func NewJSONYamlPrintFlags

func NewJSONYamlPrintFlags() *JSONYamlPrintFlags

func (*JSONYamlPrintFlags) AllowedFormats

func (f *JSONYamlPrintFlags) AllowedFormats() []string

type PrintFlags

type PrintFlags struct {
	JSONYamlPrintFlags *JSONYamlPrintFlags
	OutputFormat       *string
	Extras             *int
}

func NewPrintFlags

func NewPrintFlags() *PrintFlags

func (*PrintFlags) AddFlags

func (f *PrintFlags) AddFlags(cmd *cobra.Command)

func (*PrintFlags) AllowedFormats

func (f *PrintFlags) AllowedFormats() []string

func (*PrintFlags) ToPrinter

func (f *PrintFlags) ToPrinter() (ResourcePrinter, error)

type Printer

type Printer struct {
	PrintFlags *PrintFlags
}

func New

func New() *Printer

func NewWithPrintFlag

func NewWithPrintFlag(printFlags *PrintFlags) *Printer

func (Printer) Print

func (p Printer) Print(in interface{})

func (Printer) PrintWithTitle

func (p Printer) PrintWithTitle(title string, in interface{})

type ResourcePrinter

type ResourcePrinter interface {
	PrintObj(obj interface{}, w io.Writer) error
}

type TablePrinter

type TablePrinter struct {
	BgBlackColor  int
	HeaderFgColor int
}

func (*TablePrinter) PrintObj

func (p *TablePrinter) PrintObj(obj interface{}, w io.Writer) error

type YAMLPrinter

type YAMLPrinter struct {
}

func (*YAMLPrinter) PrintObj

func (p *YAMLPrinter) PrintObj(obj interface{}, w io.Writer) error

Jump to

Keyboard shortcuts

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