printer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Printer

type Printer interface {
	// Text prints the given text as row.
	Text(text string)

	// JSON marshales the given object into JSON string and prints that.
	JSON(obj interface{}) error

	// Error prints the given error.
	Error(err error)
}

Printer represents the behavior of the CLI results printer.

func New

func New(out io.Writer) Printer

New is the constructor of StandardOutputPrinter. Uses the given writer to print data.

func NewStandardOutputPrinter

func NewStandardOutputPrinter() Printer

NewStandardOutputPrinter is the constructor of StandardOutputPrinter. Uses stdout to print data.

type StandardPrinter

type StandardPrinter struct {
	// contains filtered or unexported fields
}

StandardPrinter implements Printer interface. Prints stuff to the out.

func (*StandardPrinter) Error

func (p *StandardPrinter) Error(err error)

JSON implements Printer interface.

func (*StandardPrinter) JSON

func (p *StandardPrinter) JSON(obj interface{}) error

JSON implements Printer interface.

func (*StandardPrinter) Text

func (p *StandardPrinter) Text(text string)

Text implements Printer interface.

Jump to

Keyboard shortcuts

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