This commit is contained in:
Zeyi Fan 2020-07-26 14:46:23 -07:00
commit 040a52ae4f
2 changed files with 7 additions and 1 deletions

View file

@ -55,6 +55,10 @@ pub struct Opt {
/// Rebuild the cargo project without the cache from previous run /// Rebuild the cargo project without the cache from previous run
pub clean: bool, pub clean: bool,
#[structopt(long = "test")]
/// Build and run only tests in module
pub test: bool,
#[structopt(short = "t", long = "toolchain", hidden = true)] #[structopt(short = "t", long = "toolchain", hidden = true)]
pub toolchain: Option<String>, pub toolchain: Option<String>,

View file

@ -125,8 +125,10 @@ pub fn run_cargo_build(options: &Opt, project: &PathBuf) -> Result<ExitStatus, C
cargo.arg(format!("+{}", toolchain)); cargo.arg(format!("+{}", toolchain));
} }
let subcommand = if options.test { "test" } else { "run" };
cargo cargo
.arg("run") .arg(subcommand)
.arg("--manifest-path") .arg("--manifest-path")
.arg(project.join("Cargo.toml")); .arg(project.join("Cargo.toml"));