Skip to content

Commit

Permalink
check whether correct target arg passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe committed Jan 10, 2019
1 parent 8af4002 commit ea3140c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ pub struct BuildOptions {
#[structopt(long = "scope", short = "s")]
pub scope: Option<String>,

#[structopt(long = "mode", short = "m", default_value = "normal")]
/// Sets steps to be run. [possible values: no-install, normal]
#[structopt(long = "mode", short = "m")]
/// Sets steps to be run. [possible values: no-install, normal, force]
pub mode: BuildMode,

#[structopt(long = "no-typescript")]
Expand Down Expand Up @@ -158,6 +158,12 @@ impl Build {
_ => bail!("Can only supply one of the --dev, --release, or --profiling flags"),
};

// `possible_values` in clap isn't supported by `structopt`
let possible_targets = ["browser", "nodejs", "no-modules"];
if !possible_targets.contains(&build_opts.target.as_str()) {
bail!("Supported targets: browser, nodejs, no-modules");
}

Ok(Build {
crate_path,
crate_data,
Expand Down

0 comments on commit ea3140c

Please sign in to comment.