Skip to main content

ralph/cli/
cleanup.rs

1//! Cleanup command CLI arguments.
2//!
3//! Responsibilities:
4//! - Define CLI arguments for the `ralph cleanup` command.
5//!
6//! Not handled here:
7//! - Actual cleanup logic (see `crate::commands::cleanup`).
8//!
9//! Invariants/assumptions:
10//! - Arguments are validated by Clap before being passed to the handler.
11
12use clap::Args;
13
14/// Arguments for `ralph cleanup`.
15#[derive(Args, Debug)]
16#[command(after_long_help = "Examples:\n\
17  ralph cleanup              # Clean temp files older than 7 days\n\
18  ralph cleanup --force      # Clean all ralph temp files\n\
19  ralph cleanup --dry-run    # Show what would be deleted without deleting")]
20pub struct CleanupArgs {
21    /// Force cleanup of all ralph temp files regardless of age.
22    #[arg(long)]
23    pub force: bool,
24
25    /// Dry run - show what would be deleted without deleting.
26    #[arg(long)]
27    pub dry_run: bool,
28}
29
30/// Handle the cleanup command.
31pub fn handle_cleanup(args: CleanupArgs) -> anyhow::Result<()> {
32    crate::commands::cleanup::run(&args)
33}