format

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputType

type OutputType string

OutputType represents the type of output, JSON, XML, TSV, etc.

var (
	// JSONFormat tell the printer to print json
	JSONFormat OutputType = "json"
)

type Printable

type Printable interface {
	Print(writer io.Writer, format OutputType) error
}

Printable is an object that can format itself

type Printer

type Printer interface {
	Print(obj interface{}) error
	Printf(format string, args ...interface{})
	ErrPrintf(format string, args ...interface{})
}

Printer prints objects

type StdPrinter

type StdPrinter struct {
	Format OutputType
}

StdPrinter is a printer that prints to os.Stdout

func (StdPrinter) ErrPrintf

func (StdPrinter) ErrPrintf(format string, args ...interface{})

ErrPrintf will print a formatted string to os.Stderr

func (StdPrinter) Print

func (stdPrinter StdPrinter) Print(obj interface{}) error

Print prints an object to os.Stdout

func (StdPrinter) Printf added in v0.2.1

func (stdPrinter StdPrinter) Printf(format string, args ...interface{})

Printf prints a formatted string

Jump to

Keyboard shortcuts

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