printer

package
v0.26.3-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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