use std::io::{self, Write};
pub fn status_tracker(current: usize, start: usize, end: usize, width: usize) {
let total = if start >= end { 1 } else { end - start };
let progress = if current < start { 0 } else { current - start };
let fraction = (progress as f64 / total as f64).min(1.0);
let percentage = (fraction * 100.0) as u32;
let filled_len = (fraction * width as f64) as usize;
let empty_len = width.saturating_sub(filled_len);
let filled = if filled_len > 0 {
format!("{}>", "=".repeat(filled_len - 1))
} else {
"".to_string()
};
let empty = " ".repeat(empty_len);
print!("\r\x1b[2K[{}{}] -> {}%", filled, empty, percentage);
io::stdout().flush().unwrap();
}