feat: vanilla server downloading + lots of ux improvements

This commit is contained in:
RafayAhmad7548 2026-08-30 18:29:17 +05:00
parent 505bfbbb5d
commit 0a12b87a2a
No known key found for this signature in database
6 changed files with 241 additions and 22 deletions

23
src/utils.rs Normal file
View file

@ -0,0 +1,23 @@
use std::{error::Error, future::Future};
use indicatif::ProgressBar;
pub async fn with_spinner<F, Fut, T>(
start_msg: &str,
finish_msg: &str,
f: F,
) -> Result<T, Box<dyn Error>>
where
F: FnOnce() -> Fut,
Fut: Future<Output = Result<T, Box<dyn Error>>>,
{
let pb = ProgressBar::new_spinner();
pb.set_message(start_msg.to_string());
pb.enable_steady_tick(std::time::Duration::from_millis(100));
let result = f().await;
pb.finish_and_clear();
println!("{} {}", dialoguer::console::style("✔").green(), finish_msg);
result
}