Expand description
A terminal filter UI for scoping streamed process output to one process name.
Ported from internal/logfilter/tui.go. Go builds this on
charm.land/bubbletea (the Elm-architecture TUI framework) and
charm.land/lipgloss for styling; this port uses ratatui with an
inline viewport (ratatui::Viewport::Inline(1) plus
Terminal::insert_before), which is the direct equivalent of Go’s
tea.Println-above-a-persistent-view pattern: a one-line status bar
stays pinned at the bottom while log lines scroll permanently above
it. See PORT_NOTES.md.
Structs§
- Context
- A narrow stand-in for Go’s
context.Context-carried TUI handle. Ported fromNewContext/FromContext. Seecrate::exec::contextfor the broader discussion of why Go’s ambient context doesn’t translate 1:1 to Rust.Context::default()carries noTui, matching Go’s zerocontext.Contexthaving nothing stored undercontextKey{}. - Tui
- Ported from
TUI. Go’sprogram/ready/donefields (the Bubble Tea program handle and its lifecycle channels) become, respectively: a channelSender<TuiEvent>the running event loop listens on (tx), and twoAtomicBools (ready/done) standing in for Go’s closed-channel-as-signal idiom.filteris unchanged from the pre-existing port. - TuiError
- Ported from the error returned by
TUI.Start. - TuiWriter
- Ported from
tuiWriter.
Functions§
- colorize_
process - Ported from
ColorizeProcess. Returnslineunchanged if it doesn’t start with a[name]prefix; otherwise wraps the[name]prefix in a truecolor ANSI SGR escape, picking the color the same way Go’slipgloss-rendered version does. Built from plain ANSI escapes (rather than threadinganstream/anstylethrough here) because this function has no access to the eventual output stream to detectNO_COLOR/non-TTY – that detection already happens one layer up, at the ratatuiCrosstermBackendthe colorized text is rendered into (ratatui only emits color escapes when the backend supports it), and atTuiWriter’s direct-write-after-donefallback, which inherits whatever styling policy its destination writer already applies (matching Go, which never strips color fromColorizeProcess’s output either). - from_
context - Ported from
FromContext. - new_
context - Ported from
NewContext.