Expand description
Terminal renderer for the generic Progress substrate.
This is the only place that turns a ProgressSnapshot into bytes on a
terminal. Domain crates drive a Progress handle; the CLI installs a
TerminalSink via the JSON-guarded factory (progress_for) so progress
is written to stderr and never leaks into result-only stdout (#550).
§Throttling lives here
Progress::inc calls render on every active tick; the sink decides
whether to actually repaint. We coalesce to at most one redraw per
COMMIT_TICK_INTERVAL completed units, but always repaint on a phase
change so stage transitions show immediately. This mirrors the cadence of
the bespoke import progress line this sink replaces.
Structs§
- Terminal
Sink - A
Sinkthat paints a single, self-overwriting progress line.
Constants§
- COMMIT_
TICK_ INTERVAL - Redraw the live line at most once per this many completed units, so a large operation doesn’t spend its time flushing the terminal. Matches the historic import cadence.
Functions§
- clear_
line - Clear an active TTY progress line before rendering command output.
- finish_
line - Paint a terminal “done” line for a finished
Progress, clearing the live line first on a TTY. No-op for a null (inactive) handle. Used by consumers that want an explicit completion marker (e.g. import’s[done]line). - format_
transfer_ bytes - progress_
for - Build a
Progresshandle for a command, applying the single JSON guard (#550) exactly once at construction: JSON output → a null handle that renders nothing; otherwise → aTerminalSink. The guard is never checked again per update.