diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-24 20:34:11 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-25 08:50:34 +0100 |
commit | f0aeeca3e5edac302aa67ca87297fe6f0ecb7473 (patch) | |
tree | 70fb42d5864a9c81164ded3bc55c97f96ceac787 /src | |
parent | 014f1889bc8c8c658923148c1471ff3c35ff57e1 (diff) |
Fix: Make sure multiprogress bars are hidden, if we hide progress bars
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/source.rs | 16 | ||||
-rw-r--r-- | src/orchestrator/orchestrator.rs | 8 | ||||
-rw-r--r-- | src/util/progress.rs | 5 |
3 files changed, 25 insertions, 4 deletions
diff --git a/src/commands/source.rs b/src/commands/source.rs index 8b1cf3e..f29ce84 100644 --- a/src/commands/source.rs +++ b/src/commands/source.rs @@ -86,7 +86,13 @@ pub(in crate::commands) async fn verify_impl<'a, I>( where I: Iterator<Item = &'a Package> + 'a, { - let multi = Arc::new(indicatif::MultiProgress::new()); + let multi = Arc::new({ + let mp = indicatif::MultiProgress::new(); + if progressbars.hide() { + mp.set_draw_target(indicatif::ProgressDrawTarget::hidden()); + } + mp + }); let results = packages .map(|p| sc.sources_for(p).into_iter()) @@ -222,7 +228,13 @@ pub async fn download( .map(String::from) .map(PackageVersionConstraint::new) .transpose()?; - let multi = indicatif::MultiProgress::new(); + let multi = { + let mp = indicatif::MultiProgress::new(); + if progressbars.hide() { + mp.set_draw_target(indicatif::ProgressDrawTarget::hidden()); + } + mp + }; let r = repo .packages() diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs index 51c6d9a..de50b36 100644 --- a/src/orchestrator/orchestrator.rs +++ b/src/orchestrator/orchestrator.rs @@ -216,7 +216,13 @@ impl<'a> Orchestrator<'a> { } async fn run_tree(self) -> Result<(Vec<ArtifactPath>, HashMap<Uuid, Error>)> { - let multibar = Arc::new(indicatif::MultiProgress::new()); + let multibar = Arc::new({ + let mp = indicatif::MultiProgress::new(); + if self.progress_generator.hide() { + mp.set_draw_target(indicatif::ProgressDrawTarget::hidden()); + } + mp + }); // For each job in the jobdag, built a tuple with // diff --git a/src/util/progress.rs b/src/util/progress.rs index 01def42..b2edc08 100644 --- a/src/util/progress.rs +++ b/src/util/progress.rs @@ -9,11 +9,14 @@ // use indicatif::*; +use getset::CopyGetters; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, CopyGetters)] pub struct ProgressBars { bar_template: String, spinner_template: String, + + #[getset(get_copy = "pub")] hide: bool, } |