#[derive(Debug, Clone, Copy, ValueEnum, PartialEq, Eq)]
pub enum SearchTarget {
Content,
Files,
Both,
}
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum SortBy {
Path,
Modified,
Created,
None,
}
#[derive(Args, Debug)]
pub struct ReplaceArgs {
#[arg(allow_hyphen_values = true)]
pub pattern: String,
#[arg(allow_hyphen_values = true)]
pub replacement: String,
#[arg(default_value = ".", value_hint = ValueHint::AnyPath)]
pub paths: Vec<PathBuf>,
#[arg(long, conflicts_with = "literal", help = "Treat pattern as regex", action = clap::ArgAction::SetTrue)]
pub regex: bool,
#[arg(short = 'w', long, help = "Match whole words only", action = clap::ArgAction::SetTrue)]
pub word: bool,
#[arg(
short = 'F',
long,
conflicts_with = "regex",
help = "Treat pattern as literal string (escape regex chars)",
action = clap::ArgAction::SetTrue
)]
pub literal: bool,
#[command(flatten)]
pub backup_opts: BackupOpts,
#[arg(short = 'g', long, action = clap::ArgAction::Append, help = "Include files matching glob")]
pub include: Vec<String>,
#[arg(long, action = clap::ArgAction::Append, help = "Exclude files matching glob")]
pub exclude: Vec<String>,
#[arg(long, help = "Show diff preview without writing", action = clap::ArgAction::SetTrue)]
pub preview: bool,
#[arg(short = 'n', long, help = "Maximum replacements per file")]
pub max_replacements: Option<usize>,
#[arg(
long,
help = "Only replace if current checksum matches (optimistic lock)"
)]
pub expect_checksum: Option<String>,
#[arg(long, help = "Show what would be done without writing", action = clap::ArgAction::SetTrue)]
pub dry_run: bool,
#[arg(
long,
help = "Preserve original casing (UPPER→UPPER, lower→lower, Title→Title)",
action = clap::ArgAction::SetTrue
)]
pub preserve_case: bool,
#[arg(
long,
value_enum,
default_value_t = FuzzyMode::Auto,
help = "Fuzzy match cascade for fixed-string replace (auto|aggressive; off rejected since v0.1.30)"
)]
pub fuzzy: FuzzyMode,
#[arg(
long,
help = "Override fuzzy similarity threshold (0.0-1.0) for replace"
)]
pub fuzzy_threshold: Option<f64>,
#[arg(
long,
default_value_t = crate::constants::DEFAULT_PROGRESS_EVERY_FILES,
help = "Emit progress NDJSON every N files visited (0=off; default constants::DEFAULT_PROGRESS_EVERY_FILES)"
)]
pub progress_every: u64,
#[arg(long, help = "Preserve original mtime (default: update mtime to now)", action = clap::ArgAction::SetTrue)]
pub preserve_timestamps: bool,
}
#[derive(Args, Debug)]
pub struct BackupArgs {
#[arg(required = true, value_hint = ValueHint::AnyPath)]
pub paths: Vec<PathBuf>,
#[arg(long, help = "Directory to store backup files", value_hint = ValueHint::DirPath)]
pub output_dir: Option<PathBuf>,
#[arg(long, default_value_t = crate::constants::DEFAULT_BACKUP_RETENTION, help = "Number of backup copies to keep (default constants::DEFAULT_BACKUP_RETENTION)")]
pub retention: u8,
#[arg(long, help = "Show what would be done without writing", action = clap::ArgAction::SetTrue)]
pub dry_run: bool,
}
#[derive(Args, Debug)]
pub struct RollbackArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
#[arg(long, help = "Timestamp of the backup to restore")]
pub timestamp: Option<String>,
#[arg(long, help = "Restore the most recent backup (default)", action = clap::ArgAction::SetTrue)]
pub latest: bool,
#[arg(long, help = "Verify checksum after restoring", action = clap::ArgAction::SetTrue)]
pub verify: bool,
#[command(flatten)]
pub backup_opts: BackupOpts,
#[arg(long, help = "Show what would be done without writing", action = clap::ArgAction::SetTrue)]
pub dry_run: bool,
}
#[derive(Args, Debug)]
pub struct GetArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
pub key_path: String,
}
#[derive(Args, Debug)]
pub struct DelArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
pub key_path: String,
#[command(flatten)]
pub backup_opts: BackupOpts,
#[arg(long, help = "Preserve original mtime/atime", action = clap::ArgAction::SetTrue)]
pub preserve_timestamps: bool,
#[arg(long, help = "Succeed silently if the key is already missing", action = clap::ArgAction::SetTrue)]
pub force_missing: bool,
}
#[derive(Args, Debug)]
pub struct OutlineArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
#[arg(
long,
value_name = "LANG",
help = "Language override (auto-detected from extension)"
)]
pub language: Option<String>,
#[arg(
long = "kind",
value_name = "KIND",
help = "Filter by kind (repeat for multiple)"
)]
pub kinds: Vec<String>,
#[arg(long, help = "Include byte offsets and start positions", action = clap::ArgAction::SetTrue)]
pub positions: bool,
}
#[derive(Args, Debug)]
pub struct WalHealArgs {
#[arg(
long,
default_value_t = crate::constants::DEFAULT_WAL_HEAL_THRESHOLD_SECS,
help = "Minimum age (seconds) for removal (default constants::DEFAULT_WAL_HEAL_THRESHOLD_SECS)"
)]
pub threshold_secs: u64,
#[arg(
long,
default_value_t = crate::constants::DEFAULT_WAL_HEAL_MAX_DURATION_MS,
help = "Wall-clock budget (ms) for the walk (default constants::DEFAULT_WAL_HEAL_MAX_DURATION_MS)"
)]
pub max_duration_ms: u64,
#[arg(long, help = "Show what would be removed without writing", action = clap::ArgAction::SetTrue)]
pub dry_run: bool,
}