From: Ian Jackson Date: Mon, 16 May 2022 00:31:30 +0000 (+0100) Subject: cli bundle progress: Report for files in the zip we're building X-Git-Tag: otter-1.1.0~84 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=982ad400f02c9bad147f7b890bfbaa94ea5bddf6;p=otter.git cli bundle progress: Report for files in the zip we're building Signed-off-by: Ian Jackson --- diff --git a/cli/usebundles.rs b/cli/usebundles.rs index b3901497..f69af11a 100644 --- a/cli/usebundles.rs +++ b/cli/usebundles.rs @@ -91,7 +91,8 @@ impl BundleForUpload { let zipfile = BufWriter::new(zipfile); let mut zipfile = zipfile::ZipWriter::new(zipfile); - for ent in entries { + let n_entries = entries.len(); + for (entry_i, ent) in entries.into_iter().enumerate() { if ent.file_type().is_dir() { continue } let tail = { @@ -104,6 +105,17 @@ impl BundleForUpload { let tail = tail.to_str() .ok_or_else(|| anyhow!("non-UTF-8 path in bundle {:?}", tail))?; + progress.report(&ProgressInfo { + phase: progress::Count { + desc: "building zip".into(), + value: progress::Value::Exact { i: 0, n: 1 }, + }, + item: progress::Count { + desc: tail.into(), + value: progress::Value::Exact { i: entry_i, n: n_entries }, + } + }); + (||{ let mut f = File::open(ent.path()) .context("start to read")?;