incpush 0.1.1

Incrementally back up a big local folder to object storage (GCS/S3/Azure), uploading only changed files and preserving previous versions
Documentation
//! Command-line surface.

use clap::{Parser, ValueEnum};
use std::path::PathBuf;

use crate::diff::DiffMode;

#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum DiffModeArg {
    /// Compare size + mtime only (default; no file contents read).
    Mtime,
    /// Cheap filter, then hash only candidates to skip touched-but-identical files.
    Hash,
    /// Hash every file (integrity audits; expensive).
    FullHash,
}

impl From<DiffModeArg> for DiffMode {
    fn from(a: DiffModeArg) -> Self {
        match a {
            DiffModeArg::Mtime => DiffMode::Mtime,
            DiffModeArg::Hash => DiffMode::Hash,
            DiffModeArg::FullHash => DiffMode::FullHash,
        }
    }
}

/// Incrementally back up a local folder to object storage, uploading only
/// changed files and preserving previous versions.
#[derive(Debug, Parser)]
#[command(name = "incpush", version, about)]
pub struct Cli {
    /// Local folder to back up.
    pub source: PathBuf,

    /// Destination URL (e.g. gs://my-bucket/my-folder/, s3://..., az://...).
    pub destination: String,

    /// Change-detection strategy.
    #[arg(long, value_enum, default_value_t = DiffModeArg::Mtime)]
    pub diff: DiffModeArg,

    /// Only print what would be uploaded; do not upload or write state.
    #[arg(short, long)]
    pub print: bool,

    /// Do not print each uploaded file.
    #[arg(short, long)]
    pub quiet: bool,

    /// Detect and record deletions this run (full manifest sweep).
    #[arg(long)]
    pub reconcile: bool,

    /// Disable first-run adoption: re-upload every file even if the destination
    /// already contains matching objects. By default a first run against a
    /// non-empty destination reuses objects that match by path + size and were
    /// not modified since (see the README).
    #[arg(long)]
    pub no_adopt: bool,

    /// Concurrent uploads.
    #[arg(long, default_value_t = 64)]
    pub concurrency: usize,

    /// Retry attempts per file.
    #[arg(long, default_value_t = 3)]
    pub retries: u32,

    /// Upload a full manifest snapshot every N runs.
    #[arg(long, default_value_t = 100)]
    pub snapshot_every: u32,

    /// zstd compression level for deltas/snapshots.
    #[arg(long, default_value_t = 6)]
    pub zstd_level: i32,

    /// Exclude paths matching this glob (repeatable). Also honors .backupignore.
    #[arg(long = "exclude", value_name = "GLOB")]
    pub excludes: Vec<String>,
}