Skip to main content

Crate termpulse

Crate termpulse 

Source
Expand description

§termpulse

Native terminal progress indicators via OSC 9;4 — with smart terminal detection, graceful fallback, throttling, and stall detection.

§Quick Start

use termpulse::Controller;

let mut ctrl = Controller::auto();
ctrl.set(50, "Building");
// ... do work ...
ctrl.done("Complete");

§Architecture

termpulse (this crate)
  ├── Controller     — stateful progress management
  ├── detect         — terminal capability detection
  ├── backend/       — output strategy (osc, ascii, silent)
  ├── throttle       — rate limiting & deduplication
  └── estimate       — ETA & throughput calculation

termpulse-core (dependency)
  └── OSC 9;4 sequence build/parse/sanitize

§Design Principles

  1. Zero-config: Controller::auto() detects the best backend
  2. Safe by default: Labels are sanitized, percentages clamped
  3. Graceful degradation: OSC → ASCII → Silent (three-tier fallback)
  4. No panic: All operations are infallible from the caller’s perspective
  5. Dependency injection: All I/O is injectable for testing

Re-exports§

pub use detect::Multiplexer;
pub use detect::TerminalCapability;

Modules§

backend
Output backends for progress indicators.
detect
Terminal capability detection.
estimate
ETA and throughput estimation.
throttle
Throttle and deduplication engine for progress updates.

Structs§

Controller
High-level progress controller.
OscSequence
A structured OSC 9;4 progress sequence.

Enums§

ProgressState
Progress indicator state.
Terminator
Sequence terminator variant.

Functions§

find_sequences
Find all OSC 9;4 sequences in the given text.
is_clean
Check if a label string is clean (contains no dangerous characters).
sanitize_label
Sanitize a label string for safe inclusion in an OSC 9;4 sequence.
strip_sequences
Strip all OSC 9;4 progress sequences from the input bytes.