Skip to main content

rgx/config/
cli.rs

1use clap::Parser;
2
3#[derive(Parser, Debug)]
4#[command(
5    name = "rgx",
6    version,
7    about = "regex101, but in your terminal",
8    long_about = "A terminal regex debugger with real-time matching, capture group highlighting, and plain-English explanations."
9)]
10pub struct Cli {
11    /// Initial regex pattern
12    #[arg(value_name = "PATTERN")]
13    pub pattern: Option<String>,
14
15    /// Engine to use: rust, fancy, or pcre2
16    #[arg(short, long)]
17    pub engine: Option<String>,
18
19    /// Case-insensitive matching
20    #[arg(short = 'i', long)]
21    pub case_insensitive: bool,
22
23    /// Multi-line mode
24    #[arg(short = 'm', long)]
25    pub multiline: bool,
26
27    /// Dot matches newline
28    #[arg(short = 's', long)]
29    pub dotall: bool,
30
31    /// Unicode mode
32    #[arg(short = 'u', long)]
33    pub unicode: Option<bool>,
34
35    /// Extended mode (ignore whitespace)
36    #[arg(short = 'x', long)]
37    pub extended: bool,
38
39    /// Initial replacement string
40    #[arg(short = 'r', long)]
41    pub replacement: Option<String>,
42}