add expand mode to use cargo-expand (#42)

This commit is contained in:
Gus Wynn 2021-02-19 21:39:53 -08:00 committed by GitHub
parent 67c5d5426e
commit 3518a8dde5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -59,7 +59,7 @@ pub struct Options {
short = "m",
long = "mode",
group = "modegroup",
possible_values = &["test", "check"]
possible_values = &["test", "check", "expand"]
)]
/// Specify run mode
pub mode: Option<String>,
@ -72,6 +72,11 @@ pub struct Options {
#[structopt(long = "check", group = "modegroup")]
pub check: bool,
/// Run code in expand mode (alias to `--mode expand`, requires
/// `cargo-expand` is installed)
#[structopt(long = "expand", group = "modegroup")]
pub expand: bool,
#[structopt(short = "t", long = "toolchain", hidden = true)]
pub toolchain: Option<String>,

View file

@ -145,6 +145,8 @@ pub fn run_cargo_build(options: &Options, project: &PathBuf) -> Result<ExitStatu
"test"
} else if options.check {
"check"
} else if options.expand {
"expand"
} else if let Some(mode) = options.mode.as_ref() {
mode.as_str()
} else {