pager

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package pager provides types and methods for paging output. It takes a value which satisfies the SetWriter interface which provides methods for setting and retrieving a standard and error writer. You pass this value to the pager.Start method and if either of the writers is connected to a terminal then it will start a pager command and insert it between the writer and the terminal. The Start method returns a pager and you must call the Done method on the returned pager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pager

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

func Start

func Start(sw SetW) *Pager

Start checks that at least one of the Writers is a terminal and if so it will start a pager command and connect the terminal writers to the input of the pager command. It returns the pager which should have Done() called on it after any output is complete.

func (*Pager) Done

func (p *Pager) Done()

Done will wait for the pager to complete. Note that it is safe to call with a nil pointer.

type SetW added in v1.0.1

type SetW interface {
	SetStdW(io.Writer)
	SetErrW(io.Writer)
	StdW() io.Writer
	ErrW() io.Writer
}

SetW

type Writers

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

Writers provides a canonical implementation of the SetW interface. It can be used as a mixin with other data structures.

func W added in v1.0.1

func W() Writers

W creates and returns a Writers object initialising it with a the os.Stdout and os.Stderr values

func (Writers) ErrW added in v1.0.1

func (ws Writers) ErrW() io.Writer

ErrW returns the value of the error writer

func (*Writers) SetErrW added in v1.0.1

func (ws *Writers) SetErrW(w io.Writer)

SetErrW sets the value of the error writer

func (*Writers) SetStdW added in v1.0.1

func (ws *Writers) SetStdW(w io.Writer)

SetStdW sets the value of the standard writer

func (Writers) StdW added in v1.0.1

func (ws Writers) StdW() io.Writer

StdW returns the value of the standard writer

Jump to

Keyboard shortcuts

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