diff --git a/xtask/src/clean.rs b/xtask/src/clean.rs new file mode 100644 index 000000000..211f6561f --- /dev/null +++ b/xtask/src/clean.rs @@ -0,0 +1,8 @@ +use crate::util::cargo; + +pub fn clean() -> anyhow::Result<()> { + cargo(["clean"])?; + cargo(["clean", "--target-dir", "target-analyzer"])?; + + Ok(()) +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ba83ecc66..c1048068c 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -5,6 +5,7 @@ use argh::FromArgs; use std::path::PathBuf; mod build_scss; +mod clean; mod util; mod watch; @@ -17,6 +18,11 @@ struct BuildScss { path: PathBuf, } +#[derive(FromArgs)] +#[argh(subcommand, name = "clean")] +/// Clean all target directories +struct Clean {} + #[derive(FromArgs)] #[argh(subcommand, name = "watch")] /// Watch for source changes and automatically check the code and run the server @@ -34,6 +40,7 @@ struct Watch { #[argh(subcommand)] enum Subcommand { BuildScss(BuildScss), + Clean(Clean), Watch(Watch), } @@ -50,6 +57,7 @@ fn main() -> anyhow::Result<()> { let command: Command = argh::from_env(); match command.subcommand { Subcommand::BuildScss(BuildScss { path }) => build_scss::build_scss(path)?, + Subcommand::Clean(..) => clean::clean()?, Subcommand::Watch(Watch { config, bin }) => watch::watch(&config, &bin)?, }