diff --git a/src/cli/commands/install.rs b/src/cli/commands/install.rs index 26eeec1..4dc7b22 100644 --- a/src/cli/commands/install.rs +++ b/src/cli/commands/install.rs @@ -211,8 +211,9 @@ impl InstallCommand { graph.values().map(|versions| versions.len() as u64).sum(), rx, &multi, - format!("{} 📥 downloading dependencies", job(3)), - format!("{} 📥 downloaded dependencies", job(3)), + format!("{} 📥 ", job(3)), + "downloading dependencies".to_string(), + "downloaded dependencies".to_string(), ) .await?; @@ -250,8 +251,9 @@ impl InstallCommand { manifest.patches.values().map(|v| v.len() as u64).sum(), rx, &multi, - format!("{} 🩹 applying patches", job(4)), - format!("{} 🩹 applied patches", job(4)), + format!("{} 🩹 ", job(4)), + "applying patches".to_string(), + "applied patches".to_string(), ) .await?; } diff --git a/src/cli/commands/update.rs b/src/cli/commands/update.rs index 5bbc3c8..697a5d2 100644 --- a/src/cli/commands/update.rs +++ b/src/cli/commands/update.rs @@ -54,8 +54,9 @@ impl UpdateCommand { graph.values().map(|versions| versions.len() as u64).sum(), rx, &multi, - "📥 downloading dependencies".to_string(), - "📥 downloaded dependencies".to_string(), + "📥 ".to_string(), + "downloading dependencies".to_string(), + "downloaded dependencies".to_string(), ) .await?; diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 3f357b5..bacb572 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -192,8 +192,9 @@ pub fn parse_gix_url(s: &str) -> Result { pub async fn progress_bar>( len: u64, - mut rx: tokio::sync::mpsc::Receiver>, + mut rx: tokio::sync::mpsc::Receiver>, multi: &MultiProgress, + prefix: String, progress_msg: String, finish_msg: String, ) -> anyhow::Result<()> { @@ -201,8 +202,10 @@ pub async fn progress_bar>( indicatif::ProgressBar::new(len) .with_style( indicatif::ProgressStyle::default_bar() - .template("{msg} {bar:40.208/166} {pos}/{len} {percent}% {elapsed_precise}")?, + .template("{prefix}[{elapsed_precise}] {bar:40.208/166} {pos}/{len} {msg}")? + .progress_chars("█▓▒░ "), ) + .with_prefix(prefix) .with_message(progress_msg), ); bar.enable_steady_tick(Duration::from_millis(100)); @@ -211,7 +214,9 @@ pub async fn progress_bar>( bar.inc(1); match result { - Ok(()) => {} + Ok(text) => { + bar.set_message(text); + } Err(e) => return Err(e.into()), } } diff --git a/src/download.rs b/src/download.rs index 474f6cc..21c5f57 100644 --- a/src/download.rs +++ b/src/download.rs @@ -17,7 +17,7 @@ use std::{ type MultithreadedGraph = Arc>; type MultithreadDownloadJob = ( - tokio::sync::mpsc::Receiver>, + tokio::sync::mpsc::Receiver>, MultithreadedGraph, ); @@ -119,6 +119,8 @@ impl Project { } } + let display_name = format!("{name}@{version_id}"); + { let mut downloaded_graph = downloaded_graph.lock().unwrap(); downloaded_graph @@ -127,7 +129,7 @@ impl Project { .insert(version_id, DownloadedDependencyGraphNode { node, target }); } - tx.send(Ok(())).await.unwrap(); + tx.send(Ok(display_name)).await.unwrap(); }); } } diff --git a/src/patches.rs b/src/patches.rs index 0f8ff52..d8fe6f4 100644 --- a/src/patches.rs +++ b/src/patches.rs @@ -76,7 +76,7 @@ impl Project { &self, graph: &DownloadedGraph, ) -> Result< - tokio::sync::mpsc::Receiver>, + tokio::sync::mpsc::Receiver>, errors::ApplyPatchesError, > { let manifest = self.deser_manifest().await?; @@ -103,7 +103,7 @@ impl Project { log::warn!( "patch for {name}@{version_id} not applied because it is not in the graph" ); - tx.send(Ok(())).await.unwrap(); + tx.send(Ok(format!("{name}@{version_id}"))).await.unwrap(); continue; }; @@ -212,7 +212,7 @@ impl Project { return; } - tx.send(Ok(())).await.unwrap(); + tx.send(Ok(format!("{name}@{version_id}"))).await.unwrap(); }); } }