pub const fn get_git_command() -> &'static strExpand description
Returns the appropriate Git command name for the current platform.
This function returns the platform-specific Git executable name that should be used when invoking Git commands via the system shell.
§Returns
"git.exe"on Windows"git"on Unix-like systems (macOS, Linux, BSD)
§Examples
use agpm_cli::utils::platform::get_git_command;
use std::process::Command;
let git_cmd = get_git_command();
let output = Command::new(git_cmd)
.args(["--version"])
.output()?;
println!("Git version: {}", String::from_utf8_lossy(&output.stdout));§Platform Differences
- Windows: Uses
git.exeto explicitly invoke the executable - Unix-like: Uses
gitwhich relies on PATH resolution
§Note
This function returns the command name, not the full path. The actual Git executable must still be available in the system PATH for commands to succeed.
§See Also
command_existsto check if Git is available- System PATH configuration for Git availability