Documentation
¶
Overview ¶
Package ui implements prettytail's full-screen follow view: a bubbletea program with a scrolling viewport and a one-row status bar. It consumes tail Events, coalesces bursts of activity behind a 100ms debounce and re-renders the whole tail window via the render package so block-structured formats stay correct as the file grows.
Terminal hygiene: bubbletea's alt-screen teardown restores the main screen and cursor on q/ctrl+c and on a normal program end; Run wraps the program so error and signal paths restore too.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
Version string
// Format is the initial format the follow view renders with, resolved
// by the caller from the file head. The TUI never runs its
// own initial detection — the first content arrives as an Append, which
// does not detect — so without this seed the model would fall back to
// its zero value (Markdown) and mis-render a console/log file until a
// Reset or `r`. Detector re-runs on Reset/`r`; this seeds the first
// render.
Format detect.Format
Detector Detector
Events <-chan tail.Event
}
Config carries the immutable inputs for a follow session.
type Detector ¶
Detector resolves the format from the current content head. The caller (cli) supplies it so --format overrides and the binary guard live in one place; Reset re-runs it so a rotated file changing shape is reclassified.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the bubbletea model for the follow view.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program wraps a bubbletea program so callers can Run it and be sure the terminal is restored on every exit path.
func New ¶
New builds a follow-view Program writing to out. Alt-screen and mouse cell-motion (wheel scroll) are enabled per spec §6.
func (*Program) Run ¶
Run starts the program and blocks until it exits, always leaving the terminal on the main screen with the cursor visible (spec §6, a hard Accept item). bubbletea's Run defers an internal shutdown that calls restoreTerminalState on EVERY return — clean quit (q/ctrl+c, ctx-driven Quit), runtime error, and recovered panic alike — so the restore is guaranteed the moment Run returns; this wrapper therefore never needs to force a teardown itself (calling Kill after Run has returned would be wrong, not defensive). ctx cancellation (SIGINT/SIGTERM, wired via signal.NotifyContext in cli.run) is bridged to prog.Quit so signal-driven shutdown runs that same graceful teardown.