feat: with doctor

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-07-30 22:33:29 +02:00
parent b5e8c78c89
commit 64c87d3192
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -221,6 +221,20 @@ impl Command {
} }
} }
} }
Some(Commands::Doctor {}) => {
match std::process::Command::new("git").arg("-v").output() {
Ok(o) => {
let stdout = std::str::from_utf8(&o.stdout).unwrap_or("".into());
self.ui.write_str_ln(&format!("OK: {}", stdout));
}
Err(e) => {
self.ui.write_str_ln(&format!(
"WARNING: git is not installed: {}",
e.to_string()
));
}
}
}
None => { None => {
tracing::debug!("running bare command"); tracing::debug!("running bare command");
// 2. Parse the cuddle.please.yaml let cuddle.please.yaml take precedence // 2. Parse the cuddle.please.yaml let cuddle.please.yaml take precedence
@ -277,6 +291,8 @@ enum Commands {
#[command(subcommand)] #[command(subcommand)]
command: GiteaCommand, command: GiteaCommand,
}, },
/// Helps you identify missing things from your execution environment for cuddle-please to function as intended
Doctor {},
} }
#[derive(Subcommand, Debug, Clone)] #[derive(Subcommand, Debug, Clone)]