output

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormatText const for text output format
	FormatText = iota
	// FormatJSON const for json output format
	FormatJSON
	// FormatYAML const for yaml output format
	FormatYAML
	// FormatUnknown const for unknown output format
	FormatUnknown
)

Variables

This section is empty.

Functions

func PrintError

func PrintError(wr io.Writer, err error)

PrintError prints an error.

func PrintFormat added in v1.5.0

func PrintFormat(wr io.Writer, outputFormat Format, encodedObject []byte, converter converterFunc) error

PrintFormat prints the object in the provided format if possible

func PrintMessage

func PrintMessage(wr io.Writer, format string, a ...interface{})

PrintMessage prints a message.

func PrintServiceManagerObject

func PrintServiceManagerObject(wr io.Writer, outputFormat Format, object types.ServiceManagerObject)

PrintServiceManagerObject should be used for printing SM objects in different formats

func PrintTable

func PrintTable(wr io.Writer, data *types.TableData)

PrintTable prints in table format

func Println

func Println(wr io.Writer)

Println prints a new line.

Types

type Format

type Format int

Format is predefined type for output format

type JSONPrinter

type JSONPrinter struct{}

JSONPrinter implements Printer interface and outputs in JSON format

func (*JSONPrinter) Print

func (p *JSONPrinter) Print(wr io.Writer, data interface{})

Print prints in json format

type Printer

type Printer interface {
	// Print is executed with writer and data to be printed
	Print(io.Writer, interface{})
}

Printer should be implemented for different output formats

type YAMLPrinter

type YAMLPrinter struct{}

YAMLPrinter implements Printer interface and outputs in YAML format

func (*YAMLPrinter) Print

func (p *YAMLPrinter) Print(wr io.Writer, data interface{})

Print prints in yaml format

Jump to

Keyboard shortcuts

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