workspacer_cli/
cleanup.rs

1// ---------------- [ File: workspacer-cli/src/cleanup.rs ]
2crate::ix!();
3
4/// The top-level CleanupSubcommand has two variants:
5///  - **Crate** => `cleanup crate --crate <NAME>` => calls `cleanup_crate()` on that crate
6///  - **Workspace** => `cleanup workspace [--path <DIR>]` => calls `cleanup_workspace()` on the entire workspace
7#[derive(Debug, StructOpt)]
8pub enum CleanupSubcommand {
9    /// Cleanup a single crate’s target/ directory, Cargo.lock, etc.
10    #[structopt(name = "crate")]
11    Crate(CleanupCrateCommand),
12
13    /// Cleanup the entire workspace’s top-level target/ and Cargo.lock
14    #[structopt(name = "workspace")]
15    Workspace(CleanupWorkspaceCommand),
16}
17
18impl CleanupSubcommand {
19    pub async fn run(&self) -> Result<(), WorkspaceError> {
20        match self {
21            CleanupSubcommand::Crate(cmd) => cmd.run().await,
22            CleanupSubcommand::Workspace(cmd) => cmd.run().await,
23        }
24    }
25}