Skip to main content

dev_sweep/cli/
args.rs

1use std::path::PathBuf;
2
3use clap::{Parser, Subcommand};
4
5/// CLI argument definitions for dev-sweep.
6#[derive(Parser)]
7#[command(
8    name = "dev-sweep",
9    about = "🧹 Find and clean build artifacts & dependency caches across all your dev projects",
10    long_about = "dev-sweep scans your filesystem for developer projects and identifies \
11                  reclaimable disk space from build artifacts, dependency caches, and \
12                  generated files. It supports 17+ project types including Rust, Node.js, \
13                  Python, Java, .NET, Go, and more.",
14    version,
15    author = "Mark Waid Jr"
16)]
17pub struct Cli {
18    #[command(subcommand)]
19    pub command: Option<Commands>,
20
21    /// Directory to scan (defaults to current directory)
22    #[arg(global = true)]
23    pub path: Option<PathBuf>,
24
25    /// Maximum directory depth to scan
26    #[arg(short = 'd', long, global = true)]
27    pub max_depth: Option<usize>,
28
29    /// Only show projects older than this (e.g. "30d", "3m", "1y")
30    #[arg(short, long, global = true)]
31    pub older_than: Option<String>,
32
33    /// Output results as JSON
34    #[arg(long, global = true)]
35    pub json: bool,
36}
37
38#[derive(Subcommand)]
39pub enum Commands {
40    /// Scan for projects and show what can be cleaned (default)
41    Scan,
42    /// Interactively select and clean projects
43    Clean {
44        /// Clean all found projects without prompting
45        #[arg(short, long)]
46        all: bool,
47        /// Show what would be cleaned without actually deleting
48        #[arg(long)]
49        dry_run: bool,
50    },
51    /// Show a quick summary of reclaimable space
52    Summary,
53    /// Manage dev-sweep configuration
54    Config {
55        /// Show the current config
56        #[arg(long)]
57        show: bool,
58        /// Reset config to defaults
59        #[arg(long)]
60        reset: bool,
61    },
62}