use ::std::path::PathBuf;
use ::clap::Parser;
use ::regex::Regex;
use crate::find::dir_with_args::OnErr;
#[derive(Parser, Debug, Default)]
#[command(
name = "files_with",
about = "Find files that match certain patterns.",
long_about = "Find files that match certain patterns. Only supports utf8, sensible filenames."
)]
pub struct FilesWithArgs {
#[arg(short = 'l', long, default_value = "10000")]
pub max_depth: u32,
#[arg(short = 'x', long = "on-error", default_value = "warn")]
pub on_err: OnErr,
#[arg(short = 'r', long = "root", default_value = ".")]
pub roots: Vec<PathBuf>,
#[arg(short = 'p', long = "path")]
pub paths: Vec<Regex>,
#[arg(short = 'c', long = "content")]
pub contents: Vec<Regex>,
#[arg(short = 'P', long = "not-path")]
pub not_paths: Vec<Regex>,
#[arg(short = 'C', long = "not-content")]
pub not_contents: Vec<Regex>,
}
#[test]
fn test_cli_args() {
FilesWithArgs::try_parse_from(&["cmd", "-r", ".", "-l", "6", "-p", ".*\\.txt", "-x=silent"]).unwrap();
FilesWithArgs::try_parse_from(&["cmd", "-r", ".", "-c", "TODO", "-P", "test.*"]).unwrap();
FilesWithArgs::try_parse_from(&["cmd", "-p", ".*\\.rs", "-p", ".*\\.toml", "-c", "async", "-C", "deprecated"]).unwrap();
}