Skip to main content

Module progress

Module progress 

Source
Expand description

Animated progress indicators for Limitless CLI.

show_progress drives either an indeterminate spinner (unknown total) or a determinate progress bar measured in steps. The animation runs on a background Tokio task so the caller can keep working without blocking; every frame replaces the previous line in place with ANSI cursor/erase escapes, which keeps the UI flicker-free.

§Usage

Spinner for indeterminate work (e.g. stack detection):

use limitless_cli::modules::progress::show_progress;

let progress = show_progress("Detecting stack...", 0);
// ... do the work ...
progress.finish("Stack detected: Node.js v18.12.0").await;

Progress bar for step-by-step work (e.g. diagnostics with a known count):

use limitless_cli::modules::progress::show_progress;

let progress = show_progress("Running diagnostics...", 4);
for _ in 0..4 {
    progress.advance();
}
progress.finish("Diagnostics complete").await;

show_progress requires an active Tokio runtime (the CLI runs inside #[tokio::main]). Dropping an unfinished handle aborts the animation and clears its line.

Structs§

Progress
Handle returned by show_progress.

Constants§

ANIMATION_INTERVAL
How long each animation frame stays on screen (braille spinner + bar).
BAR_WIDTH
Number of cells in the progress bar between the brackets.
SPINNER_FRAMES
Braille spinner frames, rotated in order every ANIMATION_INTERVAL.

Functions§

bar_line
Renders one determinate progress-bar line for step of total.
show_progress
Starts an animated progress indicator on a background Tokio task.
spinner_line
Renders one spinner line for frame_index, erasing the line first.