()
| 265 | |
| 266 | impl ProvisioningDisplay { |
| 267 | fn new() -> Self { |
| 268 | let mp = MultiProgress::new(); |
| 269 | |
| 270 | let spinner = mp.add(ProgressBar::new_spinner()); |
| 271 | spinner.set_style( |
| 272 | ProgressStyle::with_template("{spinner:.cyan} {msg} ({elapsed})") |
| 273 | .unwrap_or_else(|_| ProgressStyle::default_spinner()), |
| 274 | ); |
| 275 | spinner.enable_steady_tick(Duration::from_millis(120)); |
| 276 | |
| 277 | // Always keep a blank line below the spinner so the progress area |
| 278 | // doesn't sit flush against the bottom of the terminal. |
| 279 | let spacer = mp.add(ProgressBar::new(0)); |
| 280 | spacer.set_style( |
| 281 | ProgressStyle::with_template("{msg}").unwrap_or_else(|_| ProgressStyle::default_bar()), |
| 282 | ); |
| 283 | spacer.set_message(""); |
| 284 | |
| 285 | let now = Instant::now(); |
| 286 | Self { |
| 287 | mp, |
| 288 | spinner, |
| 289 | spacer, |
| 290 | completed_steps: Vec::new(), |
| 291 | completed_bars: Vec::new(), |
| 292 | active_label: ProvisioningStep::RequestingSandbox |
| 293 | .active_label() |
| 294 | .to_string(), |
| 295 | active_detail: String::new(), |
| 296 | step_start: now, |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /// Record a completed provisioning step with a custom label. |
| 301 | fn complete_step_with_label(&mut self, step: ProvisioningStep, label: &str) { |
nothing calls this directly
no test coverage detected