27 lines
653 B
Rust
27 lines
653 B
Rust
use cuddle_please_misc::DynUi;
|
|
|
|
pub struct DoctorCommandHandler {
|
|
ui: DynUi,
|
|
}
|
|
|
|
impl DoctorCommandHandler {
|
|
pub fn new(ui: DynUi) -> Self {
|
|
Self { ui }
|
|
}
|
|
|
|
pub fn execute(&self) -> anyhow::Result<()> {
|
|
match std::process::Command::new("git").arg("-v").output() {
|
|
Ok(o) => {
|
|
let stdout = std::str::from_utf8(&o.stdout).unwrap_or("");
|
|
self.ui.write_str_ln(&format!("OK: {}", stdout));
|
|
}
|
|
Err(e) => {
|
|
self.ui
|
|
.write_str_ln(&format!("WARNING: git is not installed: {}", e));
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
}
|