};
let is_clapified = ::std::env::args().any(|arg| match arg.as_ref() {
- "build" | "bench" | "check" => true,
+ "build" | "bench" | "check" | "clean" => true,
_ => false
});
// $mac!(bench);
// $mac!(build);
// $mac!(check);
- $mac!(clean);
+// $mac!(clean);
$mac!(doc);
$mac!(fetch);
$mac!(generate_lockfile);
--- /dev/null
+use super::utils::*;
+
+pub fn cli() -> App {
+ subcommand("clean")
+ .about("Remove artifacts that cargo has generated in the past")
+ .arg(
+ opt("package", "Package to clean artifacts for")
+ .short("p").value_name("SPEC").multiple(true)
+ )
+ .arg_manifest_path()
+ .arg_target_triple("Target triple to clean output for (default all)")
+ .arg_release("Whether or not to clean release artifacts")
+ .arg_locked()
+ .after_help("\
+If the --package argument is given, then SPEC is a package id specification
+which indicates which package's artifacts should be cleaned out. If it is not
+given, then all packages' artifacts are removed. For more information on SPEC
+and its format, see the `cargo help pkgid` command.
+")
+}
ops::compile(&ws, &compile_opts)?;
return Ok(());
}
+ ("clean", Some(args)) => {
+ config_from_args(config, args)?;
+ let ws = workspace_from_args(config, args)?;
+ let opts = ops::CleanOptions {
+ config,
+ spec: &values(args, "package"),
+ target: args.value_of("target"),
+ release: args.is_present("release"),
+ };
+ ops::clean(&ws, &opts)?;
+ return Ok(());
+ }
_ => return Ok(())
}
}
bench::cli(),
build::cli(),
check::cli(),
+ clean::cli(),
])
;
app
mod bench;
mod build;
mod check;
+mod clean;
mod utils {
use clap::{self, SubCommand, AppSettings};
self._arg(opt("release", release))
}
- fn arg_target_triple(self) -> Self {
- self._arg(opt("target", "Build for the target triple").value_name("TRIPLE"))
+ fn arg_target_triple(self, target: &'static str) -> Self {
+ self._arg(opt("target", target).value_name("TRIPLE"))
}
fn arg_manifest_path(self) -> Self {