Record a completed provisioning step with a custom label.
(&mut self, step: ProvisioningStep, label: &str)
| 299 | |
| 300 | /// Record a completed provisioning step with a custom label. |
| 301 | fn complete_step_with_label(&mut self, step: ProvisioningStep, label: &str) { |
| 302 | // Don't duplicate steps we've already printed. |
| 303 | if self.completed_steps.contains(&step) { |
| 304 | return; |
| 305 | } |
| 306 | self.completed_steps.push(step); |
| 307 | |
| 308 | let elapsed = self.step_start.elapsed(); |
| 309 | let elapsed_str = format_elapsed(elapsed); |
| 310 | |
| 311 | // Use a progress bar instead of println so we can clear it later. |
| 312 | let bar = self.mp.insert_before(&self.spinner, ProgressBar::new(0)); |
| 313 | bar.set_style( |
| 314 | ProgressStyle::with_template("{msg}").unwrap_or_else(|_| ProgressStyle::default_bar()), |
| 315 | ); |
| 316 | bar.set_message(format!( |
| 317 | "{} {} {}", |
| 318 | "\u{2713}".green().bold(), |
| 319 | label, |
| 320 | elapsed_str.dimmed() |
| 321 | )); |
| 322 | bar.finish(); |
| 323 | self.completed_bars.push(bar); |
| 324 | |
| 325 | // Reset step timer for the next step. |
| 326 | self.step_start = Instant::now(); |
| 327 | self.spinner.reset_elapsed(); |
| 328 | self.active_detail.clear(); |
| 329 | } |
| 330 | |
| 331 | /// Set the active (in-progress) step shown on the spinner. |
| 332 | fn set_active(&mut self, label: &str) { |
no test coverage detected