summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-06-01 12:43:00 +0530
committerSebastian Thiel <sthiel@thoughtworks.com>2019-06-01 12:43:52 +0530
commit961b743773da2a5112bd4ab70554c50b03ded3ad (patch)
tree08bc22433014e503e3bee1ffd86ae0be3cb48c5b /src/lib.rs
parentc1cbcf355755fbd1ca6124cdba3b8e361a7bebf2 (diff)
Add --no-total option
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0f7627a..c4e0f5b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -58,6 +58,7 @@ mod aggregate {
pub fn aggregate(
mut out: impl io::Write,
options: WalkOptions,
+ compute_total: bool,
paths: impl IntoIterator<Item = impl AsRef<Path>>,
) -> Result<WalkResult, Error> {
let mut res = WalkResult::default();
@@ -90,8 +91,14 @@ mod aggregate {
total += num_bytes;
res.num_errors += num_errors;
}
- if num_roots > 1 {
- write_path(&mut out, &options, Path::new("total"), total, res.num_errors)?;
+ if num_roots > 1 && compute_total {
+ write_path(
+ &mut out,
+ &options,
+ Path::new("total"),
+ total,
+ res.num_errors,
+ )?;
}
Ok(res)
}