cleanux 0.1.1

Linux cleaner CLI (CleanMyMac-like): scan & safely trash cache, find duplicates, list large files
Documentation
use clap::{Parser, Subcommand};
use std::path::PathBuf;

#[derive(Parser, Debug)]
#[command(
    name = "cleanux",
    version,
    about = "Linux cleaner CLI (CleanMyMac-like)"
)]
pub struct Cli {
    /// Actually perform actions (default is dry-run)
    #[arg(long, global = true, default_value_t = false)]
    pub apply: bool,

    /// Skip confirmation prompts
    #[arg(long, global = true, default_value_t = false)]
    pub yes: bool,

    /// Output format for scan/clean reports
    #[arg(long, global = true, default_value_t = ReportFormat::Text, value_enum)]
    pub report: ReportFormat,

    #[command(subcommand)]
    pub cmd: Command,
}

#[derive(Subcommand, Debug)]
pub enum Command {
    /// Scan targets and print a cleanup plan
    Scan {
        #[arg(value_enum, default_value_t = Target::All)]
        target: Target,
    },
    /// Execute cleanup (moves items to Trash)
    Clean {
        #[arg(value_enum, default_value_t = Target::All)]
        target: Target,
    },
    /// Find duplicate files (size -> BLAKE3 hash)
    Dups {
        #[arg(default_value = ".")]
        path: PathBuf,
        /// Move duplicates to Trash (keeps one copy per group)
        #[arg(long, default_value_t = false)]
        trash: bool,
        /// Skip files smaller than this size (bytes)
        #[arg(long)]
        min_bytes: Option<u64>,
        /// Skip files larger than this size (bytes)
        #[arg(long)]
        max_bytes: Option<u64>,
    },
    /// Show the largest files
    Large {
        #[arg(default_value = ".")]
        path: PathBuf,
        #[arg(long, default_value_t = 25)]
        top: usize,
        /// Skip files smaller than this size (bytes)
        #[arg(long)]
        min_bytes: Option<u64>,
        /// Skip files larger than this size (bytes)
        #[arg(long)]
        max_bytes: Option<u64>,
    },
}

#[derive(clap::ValueEnum, Clone, Copy, Debug)]
pub enum Target {
    All,
    Cache,
}

impl Target {
    pub fn allows(self, group: crate::model::CleanerGroup) -> bool {
        match self {
            Target::All => true,
            Target::Cache => group == crate::model::CleanerGroup::Cache,
        }
    }
}

#[derive(clap::ValueEnum, Clone, Debug)]
pub enum ReportFormat {
    Text,
    Json,
}