ruvector/crates/ruvector-cli/src/cli/progress.rs
rUv eef6778839 fix: Resolve CI build failures
- Format all Rust code with cargo fmt
- Generate Cargo.lock for security audit
- Add build:wasm script to graph-wasm package.json
- Update npm/package-lock.json

The CI was failing due to:
1. Rust code formatting check failures
2. Missing Cargo.lock file for cargo audit
3. Missing build:wasm script expected by graph-ci.yml workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 15:25:47 +00:00

56 lines
1.6 KiB
Rust

// ! Progress tracking for CLI operations
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use std::time::Duration;
/// Progress tracker for long-running operations
pub struct ProgressTracker {
multi: MultiProgress,
}
impl ProgressTracker {
/// Create a new progress tracker
pub fn new() -> Self {
Self {
multi: MultiProgress::new(),
}
}
/// Create a progress bar for an operation
pub fn create_bar(&self, total: u64, message: &str) -> ProgressBar {
let pb = self.multi.add(ProgressBar::new(total));
pb.set_style(
ProgressStyle::default_bar()
.template("{msg}\n{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {pos}/{len} ({eta})")
.unwrap()
.progress_chars("#>-")
);
pb.set_message(message.to_string());
pb.enable_steady_tick(Duration::from_millis(100));
pb
}
/// Create a spinner for indeterminate operations
pub fn create_spinner(&self, message: &str) -> ProgressBar {
let pb = self.multi.add(ProgressBar::new_spinner());
pb.set_style(
ProgressStyle::default_spinner()
.template("{spinner:.green} {msg}")
.unwrap(),
);
pb.set_message(message.to_string());
pb.enable_steady_tick(Duration::from_millis(100));
pb
}
/// Finish all progress bars
pub fn finish_all(&self) {
// Progress bars auto-finish when dropped
}
}
impl Default for ProgressTracker {
fn default() -> Self {
Self::new()
}
}