#[derive(Args, Debug)]
pub struct CompletionsArgs {
#[arg(value_enum)]
pub shell: ShellType,
#[arg(
long,
help = "Install completion script to XDG data directory (Bash: ~/.local/share/bash-completion/completions/atomwrite)",
action = clap::ArgAction::SetTrue
)]
pub install: bool,
}
#[derive(Args, Debug)]
pub struct VerifyArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
pub checksum: String,
}
#[derive(Args, Debug)]
pub struct DeleteArgs {
#[arg(required = true, value_hint = ValueHint::AnyPath)]
pub paths: Vec<PathBuf>,
#[command(flatten)]
pub backup_opts: BackupOpts,
#[arg(short, long, help = "Recurse into directories", action = clap::ArgAction::SetTrue)]
pub recursive: bool,
#[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 = "Only delete files older than duration (e.g. 30d, 24h, 1w)"
)]
pub older_than: Option<String>,
#[arg(
long,
conflicts_with = "dry_run",
help = "Plan only: list targets without deleting (no interactive prompt; one-shot)",
action = clap::ArgAction::SetTrue
)]
pub plan: bool,
#[arg(long, help = "Show what would be done without deleting", action = clap::ArgAction::SetTrue)]
pub dry_run: bool,
#[arg(
long,
help = "Rejected: use --plan to list targets, or omit flags to delete (one-shot; not write --confirm)",
action = clap::ArgAction::SetTrue
)]
pub confirm: bool,
#[arg(
short = 'y',
long,
help = "Rejected: no interactive confirm in one-shot; use --plan to list, omit flags to delete",
action = clap::ArgAction::SetTrue
)]
pub yes: bool,
}
#[derive(Args, Debug, Clone)]
pub struct ReadArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
#[arg(long, help = "Line range to read (1-based, e.g. 1:50)")]
pub lines: Option<String>,
#[arg(long, help = "Single line number with optional context")]
pub line: Option<usize>,
#[arg(
short = 'C',
long,
default_value_t = 0,
help = "Lines of context around --line"
)]
pub context: usize,
#[arg(long, help = "Read first N lines")]
pub head: Option<usize>,
#[arg(long, help = "Read last N lines")]
pub tail: Option<usize>,
#[arg(long, help = "Return only metadata (no content)", action = clap::ArgAction::SetTrue)]
pub stat: bool,
#[arg(
long,
value_enum,
default_value_t = OutputFormat::Ndjson,
help = "Output format (raw: always raw file bytes; default NDJSON for agents)"
)]
pub format: OutputFormat,
#[arg(
long,
help = "With --format raw: emit raw bytes (implied by --format raw; kept for compatibility)",
action = clap::ArgAction::SetTrue
)]
pub bytes: bool,
#[arg(long, help = "Verify file checksum against expected BLAKE3 hash")]
pub verify_checksum: Option<String>,
#[arg(
long,
allow_hyphen_values = true,
help = "Filter returned lines to those matching this regex"
)]
pub grep: Option<String>,
}
#[derive(Debug, Clone, Copy, ValueEnum, PartialEq, Eq)]
pub enum FuzzyMode {
Auto,
Off,
Aggressive,
}
#[derive(Args, Debug)]
pub struct EditLoopArgs {
#[arg(value_hint = ValueHint::FilePath)]
pub path: PathBuf,
#[arg(
long,
help = "Accept STATE_DRIFT (informational for edit-loop; default: reject)",
action = clap::ArgAction::SetTrue
)]
pub allow_sequential_drift: bool,
#[command(flatten)]
pub backup_opts: BackupOpts,
#[arg(
long,
value_name = "LANG",
help = "Validate syntax of the written file via tree-sitter (e.g. rust, python, js)"
)]
pub syntax_check: Option<String>,
#[arg(
long,
value_enum,
default_value_t = crate::line_endings::LineEnding::Auto,
help = "Normalize line endings: lf, crlf, cr, auto (preserve original)"
)]
pub line_ending: crate::line_endings::LineEnding,
}
include!("part1b.inc.rs");