aube_runtime/progress.rs
1//! Progress reporting hook. This crate is a library — it never prints.
2//! The CLI wires an implementation backed by `clx::progress`; tests
3//! and non-interactive callers use [`NoopProgress`].
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum InstallPhase {
7 Resolving,
8 Downloading,
9 Verifying,
10 Extracting,
11}
12
13pub trait DownloadProgress: Send + Sync {
14 /// `version` is `None` during [`InstallPhase::Resolving`] — the
15 /// exact version isn't known until resolution finishes.
16 fn on_phase(&self, _version: Option<&node_semver::Version>, _phase: InstallPhase) {}
17 fn on_download_start(&self, _total_bytes: Option<u64>) {}
18 fn on_download_chunk(&self, _bytes: u64) {}
19 fn on_done(&self) {}
20 /// An external tool (mise) is about to inherit the terminal for
21 /// its own progress output — the CLI pauses any live progress
22 /// renderer so the two don't interleave.
23 fn on_external_tool_start(&self) {}
24 fn on_external_tool_end(&self) {}
25}
26
27pub struct NoopProgress;
28
29impl DownloadProgress for NoopProgress {}