(&self, os: &Os)
| 36 | |
| 37 | impl DiagnosticArgs { |
| 38 | pub async fn execute(&self, os: &Os) -> Result<ExitCode> { |
| 39 | let spinner = if stdout().is_terminal() { |
| 40 | Some(Spinner::new(Spinners::Dots, "Generating...".into())) |
| 41 | } else { |
| 42 | None |
| 43 | }; |
| 44 | |
| 45 | if spinner.is_some() { |
| 46 | execute!(std::io::stdout(), cursor::Hide)?; |
| 47 | |
| 48 | ctrlc::set_handler(move || { |
| 49 | execute!(std::io::stdout(), cursor::Show).ok(); |
| 50 | std::process::exit(1); |
| 51 | })?; |
| 52 | } |
| 53 | |
| 54 | let diagnostics = Diagnostics::new(&os.env).await; |
| 55 | |
| 56 | if let Some(mut sp) = spinner { |
| 57 | sp.stop(); |
| 58 | execute!(std::io::stdout(), Clear(ClearType::CurrentLine), cursor::Show)?; |
| 59 | println!(); |
| 60 | } |
| 61 | |
| 62 | self.format.print( |
| 63 | || diagnostics.user_readable().expect("Failed to run user_readable()"), |
| 64 | || &diagnostics, |
| 65 | ); |
| 66 | |
| 67 | Ok(ExitCode::SUCCESS) |
| 68 | } |
| 69 | } |
nothing calls this directly
no test coverage detected