radicle_cli/commands/
clean.rs1mod args;
2
3use radicle::storage;
4use radicle::storage::WriteStorage;
5
6use crate::terminal as term;
7
8pub use args::Args;
9
10pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
11 let profile = ctx.profile()?;
12 let storage = &profile.storage;
13 let rid = args.repo;
14 let path = storage::git::paths::repository(storage, &rid);
15
16 if !path.exists() {
17 anyhow::bail!("repository {rid} was not found");
18 }
19
20 if args.no_confirm || term::confirm(format!("Clean {rid}?")) {
21 let cleaned = storage.clean(rid)?;
22 for remote in cleaned {
23 term::info!("Removed {remote}");
24 }
25 term::success!("Successfully cleaned {rid}");
26 }
27
28 Ok(())
29}