pager

package
v13.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Overview

Package pager provides methods for pager setup (more/less)

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadySet = errors.New("Pager already set")
	ErrNoPager    = errors.New("There is no pager on the system")
	ErrStdinPipe  = errors.New("Can't get pager stdin")
)
View Source
var AllowEnv bool

AllowEnv is a flag that allows to user to define pager binary using PAGER environment variable

Functions

func Complete

func Complete()

Complete finishes output redirect to pager

func Setup

func Setup(pager ...string) error

Setup set up pager for work. After calling this method, any data sent to Stdout and Stderr (using fmt, fmtc, or terminal packages) will go to the pager.

Example
// Use pager from PAGER env var or default (more -f)
Setup()

// Or provide specific command.
Setup("less -MQR")

// Complete must be called at the end of the program work. You can call it with defer
// in your main function.
defer Complete()
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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