Documentation
¶
Overview ¶
Package pager selects and runs the user's configured terminal pager.
Index ¶
- func DisabledByEnv() bool
- func ShouldPage(mode core.PagerMode, stdoutTerminal, image bool) bool
- func Stream(src io.Reader, mode core.PagerMode, stdoutTerminal, image bool, dst io.Writer) error
- func StreamContext(ctx context.Context, src io.Reader, mode core.PagerMode, ...) error
- func WriteText(data []byte, mode core.PagerMode, stdoutTerminal bool) error
- func WriteTextContext(ctx context.Context, data []byte, mode core.PagerMode, stdoutTerminal bool) error
- type Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisabledByEnv ¶
func DisabledByEnv() bool
DisabledByEnv reports whether NO_PAGER is set. Its value is intentionally ignored, so NO_PAGER=0 has the same disabling effect as NO_PAGER=1.
func ShouldPage ¶
ShouldPage reports whether text should be sent through a pager.
func Stream ¶
Stream writes a response to dst, using a pager when the selected mode calls for one. It never invokes a shell. This keeps PAGER arguments data rather than executable shell syntax.
func StreamContext ¶
func StreamContext(ctx context.Context, src io.Reader, mode core.PagerMode, stdoutTerminal, image bool, dst io.Writer) error
StreamContext is Stream with cancellation for the pager subprocess.
Types ¶
type Command ¶
Command describes a pager executable and its arguments.
func CommandFromEnv ¶
CommandFromEnv parses PAGER without invoking a shell. It keeps the legacy fallback behavior for callers that only need to inspect the selected command; StreamContext uses commandFromLookup so malformed user input is reported.