pull,package_info,ui,cli: report the pull flow via BuildView

Retire the ProgressCallback option-of-closure, the one pre-port
reporting idiom left in the tree: pull and package_info::lookup now
take &dyn BuildView like every other core flow, and the announcements
map onto message (unsized work), progress (item counts: series probes,
git objects, extraction) and progress again for byte downloads, which
the old callback carried in the same 4-argument shape.

The terminal side swaps the (ProgressBar, closure) pair for PullView, a
BuildView implementation owning one bar of the shared MultiProgress
with the same spinner/transfer style switching; it releases the line on
drop, which the CLI triggers explicitly on both outcomes since
exit(1) skips destructors. Headless callers (tests, internal lookups)
pass &report::Quiet. git clone sideband parsing is skipped entirely
when the view is not enabled, matching the old None-callback shortcut.
This commit is contained in:
vhaudiquet committed 2026-10-03 02:17:22 +02:00
1 parent 9004a33bae
commit 8c8ee5beee
8 files changed
+203 -191

No files matched your search

+6 -6
View File
@@ -670,7 +670,7 @@ fn main() {
.unwrap_or("");
let archive = sub_matches.get_one::<bool>("archive").unwrap_or(&false);
let (pb, progress_callback) = pkh::ui::create_progress_bar(&multi);
let view = pkh::ui::PullView::new(&multi);
// Convert PPA to base URL if provided
let base_url = match ppa.map(pkh::package_info::split_ppa) {
@@ -692,17 +692,17 @@ fn main() {
dist,
base_url.as_deref(),
repository,
Some(&progress_callback),
&view,
)
.await?;
pkh::pull::pull(&package_info, None, Some(&progress_callback), *archive).await
pkh::pull::pull(&package_info, None, &view, *archive).await
}) {
pb.finish_and_clear();
// exit(1) below would skip the view's Drop
drop(view);
error!("{}", e);
std::process::exit(1);
}
pb.finish_and_clear();
multi.remove(&pb);
drop(view);
info!("Done.");
}
Some(("chlog", sub_matches)) => {