Skip to content

feat(display): add --pager flag for built-in pager support #517

@unclesp1d3r

Description

@unclesp1d3r

Summary

Long output from display, audit, and convert commands dumps to the terminal in a single instant, making it impossible to read without manually piping through less or scrolling back. The tool should support built-in paging for interactive terminal use.

Proposed Solution

Add a --pager flag (and corresponding display.pager config option) that pipes output through the user's preferred pager ($PAGER, defaulting to less -R).

Scope:

  • display command (primary — always terminal output)
  • audit command (when outputting to terminal, not file)
  • convert command (when outputting to terminal, not file)

Behavior:

  • --pager enables paging (default: off, matching current behavior)
  • display.pager: true in config enables it persistently
  • Pager is skipped when output is redirected to a file (-o flag or > file)
  • Pager is skipped when stdout is not a TTY (piped to another command)
  • Respects $PAGER environment variable, falls back to less -R
  • ANSI colors must be preserved through the pager (-R flag for less)

Context

The display.pager config key already exists in the config struct (internal/config/config.go:17) and is wired through viper, but nothing reads it in the command handlers. The --pager CLI flag does not exist yet.

This also came up while prototyping VHS terminal demo GIFs — the output renders too fast to capture meaningful paging animations without built-in pager support.

Notes

  • The existing display.pager config field (config.IsDisplayPager()) is already plumbed but unused — this work would activate it
  • Consider whether --pager should be a persistent flag on root (available to all commands) or scoped per-command
  • glamour output contains ANSI escape codes — the pager must handle raw ANSI (e.g., less -R)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clicomponent:displayIssues related to display command and terminal outputconfigurationConfiguration management and settingsenhancementNew feature or requestpriority:normalNormal priority issuesp:2Story Points: 2 (small)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions