feature(cli): Add `clean` subcommand.
The new `gleam clean` command simply removes the `build` directory.
@@ -159,6 +159,9 @@ enum Command {
#[structopt(long)]
dev: bool,
},
+
+ /// Clean build artifacts
+ Clean,
}
#[derive(StructOpt, Debug, Clone)]
@@ -301,6 +304,8 @@ fn main() {
}
Command::Add { package, dev } => add::command(package, dev),
+
+ Command::Clean => clean(),
};
match result {
@@ -380,6 +385,10 @@ fn print_config() -> Result<()> {
Ok(())
}
+fn clean() -> Result<()> {
+ crate::fs::delete_dir(gleam_core::paths::build().as_path())
+}
+
fn initialise_logger() {
tracing_subscriber::fmt()
.with_env_filter(&std::env::var("GLEAM_LOG").unwrap_or_else(|_| "off".to_string()))
