Skip to content

feat: add pager support - #301

Open
marifcelik wants to merge 1 commit into
koki-develop:mainfrom
marifcelik:feat/pager
Open

marifcelik wants to merge 1 commit into
koki-develop:mainfrom
marifcelik:feat/pager

Conversation

@marifcelik

Copy link
Copy Markdown

Summary

Adds built-in pager support so colored output works automatically when viewing long files in a terminal, without losing colors through manual piping.

  • Add --paging (auto | always | never, env: GAT_PAGING, default: auto) and --pager (env: GAT_PAGER / PAGER, default: less).
  • Set LESS=FRX when LESS is unset (keeps ANSI colors, quits if output fits one screen, leaves output on screen).
  • Bypass pager automatically when output is not a TTY or contains Sixel images (both files and stdin).
  • Handle early pager exit (EPIPE) cleanly without printing a broken pipe error.
pager-demo

Test Plan

  • go test ./... (added unit tests in cmd/pager_test.go covering paging modes, LESS=FRX, Sixel bypass, image detection, and EPIPE)
  • golangci-lint run ./...
  • Cross-compile verified for linux, darwin, and windows

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