legacympt-rs/mpt/src/commands/clean.rs
LordMZTE 4b2c701574
Some checks failed
continuous-integration/drone/push Build is failing
switch from anyhow to miette
2021-10-04 21:30:13 +02:00

23 lines
741 B
Rust

use crate::{config::Config, util::CliStyle};
pub async fn run(config: Config) -> miette::Result<()> {
// These operations are so incredibly performance-critical that we absolutely
// must execute them in parallel!
// we ignore the results on purpose, so nothing fails when the dirs dont exist.
let (_, _) = tokio::join!(
async {
println!(
"{}",
format!("Deleting {}", config.locations.temp_dir.to_string_lossy()).info(),
);
tokio::fs::remove_dir_all(config.locations.temp_dir).await
},
async {
println!("{}", "Deleting build".info(),);
tokio::fs::remove_dir_all("build").await
}
);
Ok(())
}