use tokio::process::Command;
pub(super) async fn git_stdout<const N: usize>(
cwd: Option<&str>,
args: [&str; N],
) -> Option<String> {
let mut command = Command::new("git");
command.args(args);
if let Some(cwd) = cwd {
command.current_dir(cwd);
}
let output = command.output().await.ok()?;
output
.status
.success()
.then(|| String::from_utf8_lossy(&output.stdout).trim().to_string())
}
pub(super) fn needs_github_auth(command: &str) -> bool {
let lower = command.to_ascii_lowercase();
lower.starts_with("gh ")
|| lower.contains("\ngh ")
|| lower.contains(" gh ")
|| lower.contains("api.github.com")
|| lower.contains("github.com/repos/")
}