nvrim/cli/
rg.rs

1//! `rg` CLI flag builder implementation.
2//!
3//! Implements [`CliFlags`] for ripgrep with base flags emphasizing structured output and case smartness plus glob
4//! exclusions.
5
6use crate::cli::CliFlags;
7
8/// CLI flags for the `rg` command.
9pub struct RgCliFlags;
10
11impl CliFlags for RgCliFlags {
12    /// Returns the base flags for the `rg` command.
13    fn base_flags() -> Vec<&'static str> {
14        vec![
15            "--color never",
16            "--column",
17            "--hidden",
18            "--line-number",
19            "--no-heading",
20            "--smart-case",
21            "--with-filename",
22        ]
23    }
24
25    /// Returns the glob flag for the given pattern.
26    fn glob_flag(glob: &str) -> String {
27        format!("--glob !'{glob}'")
28    }
29}