Use same syntax for extra arguments as wasm-pack test

master
Frederic Kettelhoit 4 years ago
parent 260d79ac89
commit ca1f6d838c
  1. 10
      src/command/build.rs

@ -18,6 +18,7 @@ use std::fmt;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use std::time::Instant; use std::time::Instant;
use structopt::clap::AppSettings;
use PBAR; use PBAR;
/// Everything required to configure and run the `wasm-pack build` command. /// Everything required to configure and run the `wasm-pack build` command.
@ -101,6 +102,13 @@ pub enum BuildProfile {
/// Everything required to configure and run the `wasm-pack build` command. /// Everything required to configure and run the `wasm-pack build` command.
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
#[structopt(
// Allows unknown `--option`s to be parsed as positional arguments, so we can forward it to `cargo`.
setting = AppSettings::AllowLeadingHyphen,
// Allows `--` to be parsed as an argument, so we can forward it to `cargo`.
setting = AppSettings::TrailingVarArg,
)]
pub struct BuildOptions { pub struct BuildOptions {
/// The path to the Rust crate. If not set, searches up the path from the current directory. /// The path to the Rust crate. If not set, searches up the path from the current directory.
#[structopt(parse(from_os_str))] #[structopt(parse(from_os_str))]
@ -148,7 +156,7 @@ pub struct BuildOptions {
/// Sets the output file names. Defaults to package name. /// Sets the output file names. Defaults to package name.
pub out_name: Option<String>, pub out_name: Option<String>,
#[structopt(last = true)] #[structopt(allow_hyphen_values = true)]
/// List of extra options to pass to `cargo build` /// List of extra options to pass to `cargo build`
pub extra_options: Vec<String>, pub extra_options: Vec<String>,
} }

Loading…
Cancel
Save