summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-06-18 08:41:19 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-06-18 08:41:19 +0200
commitf20bf09292739e1bdbba9c1f8235a35f7d2d7712 (patch)
treecf50746d185f3e19a1f6a8b40354ff326aa174e6
parent2ebb3a00aca2eaaea5f182b1f72e21c09fcba6ee (diff)
Make progress bar for loading DAG optional
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/commands/build.rs2
-rw-r--r--src/commands/tree_of.rs2
-rw-r--r--src/package/dag.rs6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/commands/build.rs b/src/commands/build.rs
index 8825750..ff2769d 100644
--- a/src/commands/build.rs
+++ b/src/commands/build.rs
@@ -226,7 +226,7 @@ pub async fn build(
let dag = {
let bar_tree_building = progressbars.bar();
- let dag = Dag::for_root_package(package.clone(), &repo, &bar_tree_building)?;
+ let dag = Dag::for_root_package(package.clone(), &repo, Some(&bar_tree_building))?;
bar_tree_building.finish_with_message("Finished loading Dag");
dag
};
diff --git a/src/commands/tree_of.rs b/src/commands/tree_of.rs
index e632ed5..a2ae0c5 100644
--- a/src/commands/tree_of.rs
+++ b/src/commands/tree_of.rs
@@ -48,7 +48,7 @@ pub async fn tree_of(
})
.map(|package| {
let bar_tree_building = progressbars.bar();
- let tree = Dag::for_root_package(package.clone(), &repo, &bar_tree_building)?;
+ let tree = Dag::for_root_package(package.clone(), &repo, Some(&bar_tree_building))?;
bar_tree_building.finish_with_message("Finished loading Tree");
Ok(tree)
})
diff --git a/src/package/dag.rs b/src/package/dag.rs
index 1075dda..102355a 100644
--- a/src/package/dag.rs
+++ b/src/package/dag.rs
@@ -40,14 +40,14 @@ impl Dag {
pub fn for_root_package(
p: Package,
repo: &Repository,
- progress: &ProgressBar,
+ progress: Option<&ProgressBar>,
) -> Result<Self> {
fn add_sub_packages<'a>(
repo: &'a Repository,
mappings: &mut HashMap<&'a Package, daggy::NodeIndex>,
dag: &mut daggy::Dag<&'a Package, i8>,
p: &'a Package,
- progress: &ProgressBar
+ progress: Option<&ProgressBar>
) -> Result<()> {
p.get_self_packaged_dependencies()
.and_then_ok(|(name, constr)| {
@@ -63,7 +63,7 @@ impl Dag {
// recurse
packs.into_iter()
.try_for_each(|p| {
- progress.tick();
+ progress.as_ref().map(|p| p.tick());
let idx = dag.add_node(p);
mappings.insert(p, idx);