printer

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 6 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 PrintJson

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

func PrintTable

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

PrintTable outputs a dataset in tabular format

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"
	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(defaultFormat Format, allowedFormats []Format) error

Jump to

Keyboard shortcuts

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