HeadlinesBriefing favicon HeadlinesBriefing.com

Developer Builds Custom Terminal Pager from TUI Components

Hacker News •
×

A developer has built their own terminal pager called lore after creating a reusable viewport component in Go for their existing TUI projects. The author previously built tools like kl for Kubernetes logs and wander for Nomad, extracting common text navigation functionality into a standalone component that now powers their daily driver pager.

The viewport handles the core functionality terminal pagers need: flexibly-sized text boxes that are scrollable, provide position indicators, support text wrapping with horizontal panning, enable search with match navigation, handle ANSI escape codes for styling, and manage Unicode characters. Written in Go, it integrates with the Bubble Tea TUI framework and can be tested via a single go run command.

Terminal pagers like the ubiquitous "less" let developers interactively navigate multi-page text output from commands, logs, git diffs, and database queries. Most programs fall back to less if the PAGER environment variable isn't set. The author found existing options lacking for their workflow, so they built lore to meet their specific needs, now using it as their default pager.