summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-11-07 16:04:45 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-11-07 17:34:00 +0100
commite4512d60e989f7d31febabb3934fd028af48522b (patch)
tree977a91820c85b09cf058711e14d8aec900ac539a
parenta3c4b3900b6aff923e9c1f0fafbf6cb1069def83 (diff)
Degrade ProgressBars to a simple progress-bar-generation helper
This patch removes the idea of having a "MultiProgress" object from indicativ available in the top level of butido. It turned out that the progress bars were not updated until the MultiProgress::join() method was called, which basically yields the progress bars useless. Thus, we remove the multi-progress-bar idea from top level. Later, we might implement a multi-progress bar viewing in the orchestrator, so we can see which job is progressed how far. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-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 {