Skip to main content

require_tool_with_arg

Function require_tool_with_arg 

Source
pub fn require_tool_with_arg(
    name: &str,
    version_arg: &str,
    install_hint: &str,
) -> Result<(), String>
Expand description

Check that an external tool is available in $PATH.

Runs <name> <version_arg> and returns Ok(()) if it exits successfully, or an error message with the install hint. Most tools use --version; see require_tool for a convenience wrapper.

ยงExample

// koji uses `version` subcommand instead of `--version`
sandogasa_cli::require_tool_with_arg("koji", "version", "sudo dnf install koji").unwrap();