Skip to content

feat(display): route long output through $PAGER - #203

Merged
ruby-automation merged 1 commit into
mainfrom
ext-23-pager-support
Sep 3, 2026
Merged

feat(display): route long output through $PAGER#203
ruby-automation merged 1 commit into
mainfrom
ext-23-pager-support

Conversation

@ruby-automation

Copy link
Copy Markdown
Contributor

Summary

  • Add LinearCli.CLI.Pager module with maybe_page/2 that routes text through $PAGER (default: less -FRX) when stdout is a terminal and content exceeds terminal height
  • Refactor Display.show/2 text path to collect all output into a single string, then delegate to Pager.maybe_page/2 instead of calling IO.puts per item
  • Paging is skipped for JSON output, non-TTY, PAGER="", PAGER=cat, and content that fits on screen
  • Falls back to IO.puts when pager exits with non-zero status (e.g. pager not found)

Test plan

  • 12 new pager tests: not-a-TTY bypass, PAGER disabled variants, short/exact-height content, pager invocation, default less -FRX, custom $PAGER, temp-file content, temp-file cleanup, cleanup on crash, non-zero exit fallback
  • All 364 tests pass (364 = 363 pre-existing + 1 new fallback test)
  • mix credo clean
  • mix format --check-formatted clean

Closes EXT-23

🤖 Generated with Claude Code

Add LinearCli.CLI.Pager module that pipes text output through the
user's configured pager (default: less -FRX) when stdout is a terminal
and the content exceeds the terminal height. Refactor Display.show/2
to collect all text first, then delegate to Pager.maybe_page/2.
Paging is skipped for JSON output, non-TTY environments, PAGER=""
or PAGER=cat, and content that fits on screen. Falls back to IO.puts
when the pager exits with a non-zero status.

Closes EXT-23

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ruby-automation
ruby-automation merged commit c8f42da into main Sep 3, 2026
3 checks passed
@ruby-automation
ruby-automation deleted the ext-23-pager-support branch September 3, 2026 16:00
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