summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs4
-rw-r--r--src/util/progress.rs26
2 files changed, 12 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs
index fbb7dea..a16208e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -63,7 +63,7 @@ async fn main() -> Result<()> {
let repo_path = PathBuf::from(config.repository());
let _ = crate::ui::package_repo_cleanness_check(&repo_path)?;
let max_packages = count_pkg_files(&repo_path);
- let mut progressbars = ProgressBars::setup(config.progress_format().clone());
+ let progressbars = ProgressBars::setup(config.progress_format().clone());
let mut load_repo = || -> Result<Repository> {
let bar = progressbars.repo_loading();
@@ -108,7 +108,7 @@ async fn main() -> Result<()> {
(other, _) => return Err(anyhow!("Unknown subcommand: {}", other)),
}
- progressbars.into_inner().join().map_err(Error::from)
+ Ok(())
}
async fn build<'a>(matches: &ArgMatches,
diff --git a/src/util/progress.rs b/src/util/progress.rs
index 70742ae..ca4c96b 100644
--- a/src/util/progress.rs
+++ b/src/util/progress.rs
@@ -1,40 +1,34 @@
use indicatif::*;
pub struct ProgressBars {
- multi: MultiProgress,
bar_template: String,
}
impl ProgressBars {
pub fn setup(bar_template: String) -> Self {
ProgressBars {
- multi: MultiProgress::new(),
bar_template,
}
}
- pub fn into_inner(self) -> MultiProgress {
- self.multi
+ pub fn tree_building(&self) -> ProgressBar {
+ Self::bar("Building package tree", &self.bar_template)
}
- pub fn tree_building(&mut self) -> ProgressBar {
- self.multi.add(Self::bar("Building package tree", &self.bar_template))
+ pub fn repo_loading(&self) -> ProgressBar {
+ Self::bar("Repository loading", &self.bar_template)
}
- pub fn repo_loading(&mut self) -> ProgressBar {
- self.multi.add(Self::bar("Repository loading", &self.bar_template))
+ pub fn staging_loading(&self) -> ProgressBar {
+ Self::bar("Loading staging", &self.bar_template)
}
- pub fn staging_loading(&mut self) -> ProgressBar {
- self.multi.add(Self::bar("Loading staging", &self.bar_template))
+ pub fn release_loading(&self) -> ProgressBar {
+ Self::bar("Loading releases", &self.bar_template)
}
- pub fn release_loading(&mut self) -> ProgressBar {
- self.multi.add(Self::bar("Loading releases", &self.bar_template))
- }
-
- pub fn what_depends(&mut self) -> ProgressBar {
- self.multi.add(Self::bar("Crawling dependencies", &self.bar_template))
+ pub fn what_depends(&self) -> ProgressBar {
+ Self::bar("Crawling dependencies", &self.bar_template)
}
fn bar(msg: &str, template: &str) -> ProgressBar {