Skip to content

Commit

Permalink
Merge #2652 #2655
Browse files Browse the repository at this point in the history
2652: Update documentation for the multi_value feature r=ptitSeb a=Amanieu

Fixes #2496

2655: Fix argument parsing of --dir and --mapdir r=syrusakbary a=Amanieu

Previously in "wasmer --dir foo bar.wasm" the "bar.wasm" was being
treated as another directory instead of the module to run.

Fixes #2445

# Review

- [ ] Add a short description of the change to the CHANGELOG.md file


Co-authored-by: Amanieu d'Antras <[email protected]>
  • Loading branch information
bors[bot] and Amanieu authored Nov 5, 2021
3 parents e389ad0 + cf09d13 + 680d6bb commit c513b39
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/cli/src/commands/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Compile {
#[structopt(flatten)]
store: StoreOptions,

#[structopt(short = "m", multiple = true)]
#[structopt(short = "m", multiple = true, number_of_values = 1)]
cpu_features: Vec<CpuFeature>,
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cli/src/commands/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ pub struct CreateExe {
#[structopt(flatten)]
compiler: CompilerOptions,

#[structopt(short = "m", multiple = true)]
#[structopt(short = "m", multiple = true, number_of_values = 1)]
cpu_features: Vec<CpuFeature>,

/// Additional libraries to link against.
/// This is useful for fixing linker errors that may occur on some systems.
#[structopt(short = "l", multiple = true)]
#[structopt(short = "l", multiple = true, number_of_values = 1)]
libraries: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct Run {
verbose: u8,

/// Application arguments
#[structopt(name = "--", multiple = true)]
#[structopt(value_name = "ARGS")]
args: Vec<String>,
}

Expand Down
23 changes: 20 additions & 3 deletions lib/cli/src/commands/run/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,32 @@ use structopt::StructOpt;
/// WASI Options
pub struct Wasi {
/// WASI pre-opened directory
#[structopt(long = "dir", name = "DIR", multiple = true, group = "wasi")]
#[structopt(
long = "dir",
name = "DIR",
multiple = true,
group = "wasi",
number_of_values = 1
)]
pre_opened_directories: Vec<PathBuf>,

/// Map a host directory to a different location for the Wasm module
#[structopt(long = "mapdir", name = "GUEST_DIR:HOST_DIR", multiple = true, parse(try_from_str = parse_mapdir))]
#[structopt(
long = "mapdir",
name = "GUEST_DIR:HOST_DIR",
multiple = true,
parse(try_from_str = parse_mapdir),
number_of_values = 1,
)]
mapped_dirs: Vec<(String, PathBuf)>,

/// Pass custom environment variables
#[structopt(long = "env", name = "KEY=VALUE", multiple = true, parse(try_from_str = parse_envvar))]
#[structopt(
long = "env",
name = "KEY=VALUE",
multiple = true,
parse(try_from_str = parse_envvar),
)]
env_vars: Vec<(String, String)>,

/// Enable experimental IO devices
Expand Down
9 changes: 4 additions & 5 deletions lib/types/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,14 @@ impl Features {
/// Configures whether the WebAssembly multi-value proposal will
/// be enabled.
///
/// The [WebAssembly multi-value proposal][proposal] is not
/// currently fully standardized and is undergoing development.
/// Support for this feature can be enabled through this method for
/// appropriate WebAssembly modules.
/// The [WebAssembly multi-value proposal][proposal] is now fully
/// standardized and enabled by default, except with the singlepass
/// compiler which does not support it.
///
/// This feature gates functions and blocks returning multiple values in a
/// module, for example.
///
/// This is `false` by default.
/// This is `true` by default.
///
/// [proposal]: https://github.com/webassembly/multi-value
pub fn multi_value(&mut self, enable: bool) -> &mut Self {
Expand Down

0 comments on commit c513b39

Please sign in to comment.