Expand description
Centralized progress bar and spinner utilities.
This module provides consistent progress bar creation and styling across all CLI commands, ensuring uniform user feedback during long-running operations.
§Progress Bar Styling
All progress bars use a standardized format:
[00:01:23] =========>------------------------------ 234MB/1GB (00:02:15)
^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^
elapsed visual bar (40 chars) bytes ETA§Spinner Styling
Spinners are used for indeterminate operations (e.g., waiting for network):
⠋ Connecting to remote storage...§Usage
use hexz_cli::ui::progress::{create_progress_bar, create_spinner};
// Determinate operation
let pb = create_progress_bar(1024 * 1024 * 100); // 100 MB
for _ in 0..100 {
pb.inc(1024 * 1024); // 1 MB per iteration
}
pb.finish_with_message("Complete");
// Indeterminate operation
let sp = create_spinner("Processing...");
std::thread::sleep(std::time::Duration::from_millis(100));
sp.finish_with_message("Done");Functions§
- create_
progress_ bar - Creates a standardized progress bar for determinate operations.
- create_
spinner - Creates a spinner for indeterminate operations.