printer

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTableSection added in v0.28.0

func NewTableSection(out io.Writer) *tablewriter.Table

func NewTableWriter

func NewTableWriter(out io.Writer) *tabwriter.Writer

func PrintJson

func PrintJson(out io.Writer, v interface{}) error

func PrintPlaintext

func PrintPlaintext(out io.Writer, v interface{}) error

PrintPlaintext is a printer that prints the provided value as is

func PrintTable

func PrintTable(out io.Writer, v interface{}, getRow func(row interface{}) []interface{}, headers ...interface{}) error

func PrintTableSection added in v0.28.0

func PrintTableSection(out io.Writer, v interface{}, getRow func(row interface{}) []string, headers ...string) error

func PrintYaml

func PrintYaml(out io.Writer, v interface{}) error

PrintYaml is a printer that prints the provided value in yaml

Types

type Format

type Format string
const (
	FormatJson      Format = "json"
	FormatTable     Format = "table"
	FormatYaml      Format = "yaml"
	FormatPlaintext Format = "plaintext"
)

type Formats

type Formats []Format

func (Formats) String

func (f Formats) String() string

type PrintOptions

type PrintOptions struct {
	RawFormat string
	Format
}

func (*PrintOptions) ParseFormat

func (p *PrintOptions) ParseFormat() error

func (*PrintOptions) Validate

func (p *PrintOptions) Validate(allowedFormats []Format) error

Jump to

Keyboard shortcuts

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