Skip to content

Commit

Permalink
Add clean subcommand to xtask (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra authored Mar 9, 2024
1 parent d24354f commit 9121549
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xtask/src/clean.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use crate::util::cargo;

pub fn clean() -> anyhow::Result<()> {
cargo(["clean"])?;
cargo(["clean", "--target-dir", "target-analyzer"])?;

Ok(())
}
8 changes: 8 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use argh::FromArgs;
use std::path::PathBuf;

mod build_scss;
mod clean;
mod util;
mod watch;

Expand All @@ -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
Expand All @@ -34,6 +40,7 @@ struct Watch {
#[argh(subcommand)]
enum Subcommand {
BuildScss(BuildScss),
Clean(Clean),
Watch(Watch),
}

Expand All @@ -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)?,
}

Expand Down

0 comments on commit 9121549

Please sign in to comment.