Skip to content

feat: pipe output through pager when it exceeds terminal height#173

Open
DamanHanzo wants to merge 1 commit into
kantord:mainfrom
DamanHanzo:feat/pager
Open

feat: pipe output through pager when it exceeds terminal height#173
DamanHanzo wants to merge 1 commit into
kantord:mainfrom
DamanHanzo:feat/pager

Conversation

@DamanHanzo

Copy link
Copy Markdown
Contributor

Output is piped through a pager when it exceeds terminal height — same behavior as git log.

  • Activates only when stdout is a TTY and output line count > terminal height
  • Uses $PAGER if set, otherwise less -R (preserves ANSI colors)
  • Falls back to direct print if the pager fails to spawn
  • Ignores broken pipe (user quit pager early — intentional)
  • PAGER=cat or piping (blog | cat) disables it
  • No new dependencies (uses std::process for pager, terminal_size is already present)

Files changed

File What
src/commands/show.rs output_with_pager(), output buffering, TTY/height gating

Testing

No integration test (requires TTY). Falls back gracefully in piped/test contexts. All existing tests pass.

Split from #166 per review feedback.

@DamanHanzo DamanHanzo marked this pull request as ready for review April 26, 2026 18:11
@kantord kantord self-requested a review May 1, 2026 08:47
@DamanHanzo

Copy link
Copy Markdown
Contributor Author

@kantord same here - I'll fix and resolve the conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant