Skip to main content

vtcode_core/tools/
ripgrep_binary.rs

1pub const RIPGREP_INSTALL_COMMAND: &str = "vtcode dependencies install ripgrep";
2
3#[cold]
4pub fn missing_ripgrep_message(suffix: &str) -> String {
5    let extra = if suffix.is_empty() {
6        String::new()
7    } else {
8        format!(" {suffix}")
9    };
10    format!(
11        "ripgrep (`rg`) is not available on PATH; run `{RIPGREP_INSTALL_COMMAND}` or install `ripgrep` manually.{extra}"
12    )
13}
14
15#[cfg(test)]
16mod tests {
17    use super::{RIPGREP_INSTALL_COMMAND, missing_ripgrep_message};
18
19    #[test]
20    fn missing_message_includes_install_command() {
21        let message = missing_ripgrep_message("VT Code can fall back to built-in grep.");
22        assert!(message.contains(RIPGREP_INSTALL_COMMAND));
23        assert!(message.contains("built-in grep"));
24    }
25}