Documentation
¶
Overview ¶
Package livetui cmd/skywire-cli/cliutil/livetui/livetui.go c4-vis-cli helper. Wraps any function that produces a string in a scrollable viewport that re-renders on a configurable tick. Used by CLI commands that want a watch(1)-style live refresh without taking a dependency on watch(1) and without the "every tick rewrites the whole screen" terminal-jump experience.
Use: build a Refresh callback that returns the snapshot the user should see RIGHT NOW (as a string). Pass it to Run with an interval. Run blocks until the user hits q / Ctrl+C; while it's running it calls Refresh every interval and pipes the result into a viewport that the user can scroll up/down independently of new frames arriving.
The viewport preserves scroll position when new content streams in — same Ink-style "scrollable while updating" pattern Claude Code uses, mirrored here for skywire CLI commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Title shown in the header. Defaults to "skywire live".
Title string
// Interval between Refresh calls. Defaults to 1s. Don't go
// below ~200ms — bubbletea's render budget gets uncomfortable
// and the spinner stutters.
Interval time.Duration
}
Options tunes a Run invocation. All fields optional; sensible defaults below.
type Refresh ¶
Refresh produces the snapshot to display on each tick. ctx is canceled when the user quits the TUI; long-running Refresh implementations should respect it so the program shuts down promptly. Errors are surfaced in the header line (red) but don't terminate the loop — operators usually want to watch a transient error recover live rather than have the TUI die.