synwire_core/vfs/grep_options.rs
1//! Grep options and result types.
2
3use serde::{Deserialize, Serialize};
4
5/// Grep output mode.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
7#[non_exhaustive]
8pub enum GrepOutputMode {
9 /// Return matching lines with content.
10 #[default]
11 Content,
12 /// Return only file paths with matches.
13 FilesWithMatches,
14 /// Return match counts per file.
15 Count,
16}
17
18/// Grep search options (ripgrep-style).
19#[derive(Debug, Clone, Default, Serialize, Deserialize)]
20#[allow(clippy::struct_excessive_bools)]
21pub struct GrepOptions {
22 /// Search root path (None = current working directory).
23 pub path: Option<String>,
24 /// Lines of context after each match.
25 pub after_context: u32,
26 /// Lines of context before each match.
27 pub before_context: u32,
28 /// Symmetric context (overrides before/after if set).
29 pub context: Option<u32>,
30 /// Case-insensitive search.
31 pub case_insensitive: bool,
32 /// File glob filter (e.g., "*.rs").
33 pub glob: Option<String>,
34 /// File type filter (e.g., "rust", "python").
35 pub file_type: Option<String>,
36 /// Maximum number of matches to return.
37 pub max_matches: Option<usize>,
38 /// Output mode.
39 pub output_mode: GrepOutputMode,
40 /// Enable multiline matching (pattern can span lines).
41 pub multiline: bool,
42 /// Include line numbers in output.
43 pub line_numbers: bool,
44 /// Invert match (show non-matching lines).
45 pub invert: bool,
46 /// Treat pattern as literal string (not regex).
47 pub fixed_string: bool,
48}