corge/command/clean.rs
1use crate::cli::CleanArgs;
2use anyhow::{Context, Result};
3use std::fs;
4
5pub fn clean(clean_args: CleanArgs) -> Result<()> {
6 fs::remove_dir_all(clean_args.path.join("target"))
7 .with_context(|| format!("Failed to remove directory {:?}", &clean_args.path.join("target")))?;
8
9 if clean_args.deps_too {
10 fs::remove_dir_all(clean_args.path.join("dependency"))
11 .with_context(|| format!("Failed to remove directory {:?}", &clean_args.path.join("dependency")))?;
12 }
13
14 Ok(())
15}