pager

package
v0.60.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 19 Imported by: 0

README

Documentation

Overview

Package pager provides a pager (similar to less) for the terminal.

$ cat file.txt | gum pager

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LipglossPadding

func LipglossPadding(style lipgloss.Style) (int, int)

LipglossPadding calculates how much padding a string is given by a style.

func Pager

func Pager(content string) error

Pager divides and prints the given output "page by page" using the size of the current terminal.

Navigation keys:

	n Space/Enter : forward one page
	b             : back one page
	q             : quit / cancel
	<number>      : jump to that page number (1-based)
 Arrow keys       : navigate using up/down

Types

type Options

type Options struct {
	//nolint:staticcheck
	Style           style.Styles `` /* 151-byte string literal not displayed */
	Content         string       `hidden:"" arg:"" optional:"" help:"Display content to scroll"`
	ShowLineNumbers bool         `hidden:"" help:"Show line numbers" default:"true"`
	LineNumberStyle style.Styles `` /* 133-byte string literal not displayed */
	SoftWrap        bool         `hidden:"" help:"Soft wrap lines" default:"true" negatable:""`
	MatchStyle      style.Styles `` //nolint:staticcheck
	/* 144-byte string literal not displayed */
	MatchHighlightStyle style.Styles `` //nolint:staticcheck
	/* 197-byte string literal not displayed */
	Timeout time.Duration `hidden:"" help:"Timeout until command exits" default:"0s" env:"GUM_PAGER_TIMEOUT"`

	Scroll bool   `help:"Scroll content" short:"s" default:"false"`
	File   string `help:"File to scroll"`

	// Deprecated: this has no effect anymore.
	HelpStyle style.Styles `` /* 126-byte string literal not displayed */
}

Options are the options for the pager.

func (*Options) Paginate

func (o *Options) Paginate() error

func (*Options) Run

func (o *Options) Run() error

Run provides a shell script interface for the viewport bubble. https://github.com/charmbracelet/bubbles/viewport

func (*Options) ScrollPage

func (o *Options) ScrollPage() error

type Paginator

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

func (Paginator) Init

func (m Paginator) Init() tea.Cmd

func (Paginator) Update

func (m Paginator) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Paginator) View

func (m Paginator) View() string

Jump to

Keyboard shortcuts

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