text

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 6 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 {
	// P writes the arguments and a newline with the current indent.
	//
	// Spaces are stripped from the end of the line, and only a newline is printed
	// if the args result in only spaces or no value.
	P(args ...interface{})
	// In indents.
	In()
	// Out unindents.
	Out()
}

Printer is a printer.

func NewPrinter

func NewPrinter(writer io.Writer, options ...PrinterOption) Printer

NewPrinter returns a new Printer.

type PrinterOption

type PrinterOption func(*printer)

PrinterOption is an option for a printer.

func PrinterWithErrorRecorder

func PrinterWithErrorRecorder(errorRecorder func(error)) PrinterOption

PrinterWithErrorRecorder returns a new PrinterOption that records errors.

The default is to drop errors.

func PrinterWithIndent

func PrinterWithIndent(indent string) PrinterOption

PrinterWithIndent returns a new PrinterOption that uses the given indent.

The default is two spaces.

Jump to

Keyboard shortcuts

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