Skip to main content

Module streamed

Module streamed 

Source
Expand description

Streaming command execution (TTY scrolling area / prefixed lines / logger fallback).

Ported from internal/executor/exec_streamed.go. Uses the same tokio::process::Command + background-runtime bridge as exec::run (see exec::runtime). chooseStreamer’s three-way fan-out is ported as choose_streamer/Streamer: a scrolling area (TTY + use_scrolling_area), prefixed lines (TTY, no scrolling area), or the tracing-based logger fallback (no TTY) used by every existing test in this module (stderr isn’t a terminal under cargo test).

Go renders with pterm (ANSI styling) directly. This port uses anstyle for the SGR codes and writes through anstream’s auto-detecting stream wrapper, which strips styling when stdout/stderr isn’t a terminal or NO_COLOR is set – matching this project’s terminal-accessibility requirements without each call site needing its own NO_COLOR check.

Structs§

AreaPrinter
A port of pterm.AreaPrinter: an in-place, self-redrawing block of terminal lines (not a full alternate-screen TUI – pterm itself is a terminal-formatting library, not a TUI framework, so cursor-up-and- overwrite via raw ANSI escapes is the faithful equivalent, matching what pterm.AreaPrinter does internally).
ExecStreamedOpts
Ported from ExecStreamedOpts.

Functions§

exec_streamed_command
Ported from the package-level execStreamedCommand function.
flush_lines_to_area
Ported from flushLinesToArea.
is_stderr_tty
Ported from isStderrTTY.
truncate_line
Ported from truncateLine.
wrap_line
Ported from wrapLine.
write_prefixed_lines_filtered
Ported from writePrefixedLinesFiltered. tui mirrors *logfilter.TUI; see crate::logfilter for its port status.