pager

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PassthroughPager = &Pager{
	WriteCloser: os.Stdout,
	isCloseable: false,
}

PassthroughPager is a Pager writing the content directly to stdout without pagination.

Functions

This section is empty.

Types

type Pager

type Pager struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

Pager writes text to a terminal using the user's pager.

func New

func New(pagerCmd opt.String, logger util.Logger) (*Pager, error)

New creates a pager.Pager to be used to write a paginated text to the terminal.

func (*Pager) Close

func (p *Pager) Close() error

Close terminates the pager, waiting for the process to be finished before returning.

We make sure Close is called only once, since we don't know how it is implemented in underlying writers.

func (*Pager) WriteString

func (p *Pager) WriteString(text string) error

WriteString sends the given text to the pager, ending with a newline.

Jump to

Keyboard shortcuts

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