Skip to content

Commit

Permalink
Rename "run2" to "run-unstable"
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Mar 20, 2023
1 parent 480cdb6 commit 60fcba4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
16 changes: 9 additions & 7 deletions lib/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::commands::CreateExe;
#[cfg(feature = "wast")]
use crate::commands::Wast;
use crate::commands::{
Add, Cache, Config, Init, Inspect, List, Login, Publish, Run, Run2, SelfUpdate, Validate,
Whoami,
Add, Cache, Config, Init, Inspect, List, Login, Publish, Run, RunUnstable, SelfUpdate,
Validate, Whoami,
};
#[cfg(feature = "static-artifact-create")]
use crate::commands::{CreateObj, GenCHeader};
Expand Down Expand Up @@ -162,8 +162,8 @@ enum WasmerCLIOptions {
/// Add a WAPM package's bindings to your application.
Add(Add),

/// Run a WebAssembly file or WEBC container.
Run2(Run2),
/// (unstable) Run a WebAssembly file or WEBC container.
RunUnstable(RunUnstable),
}

impl WasmerCLIOptions {
Expand Down Expand Up @@ -193,7 +193,7 @@ impl WasmerCLIOptions {
Self::Binfmt(binfmt) => binfmt.execute(),
Self::Whoami(whoami) => whoami.execute(),
Self::Add(install) => install.execute(),
Self::Run2(run2) => run2.execute(),
Self::RunUnstable(run2) => run2.execute(),
}
}
}
Expand Down Expand Up @@ -246,8 +246,10 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> {
} else {
match command.unwrap_or(&"".to_string()).as_ref() {
"add" | "cache" | "compile" | "config" | "create-obj" | "create-exe" | "help"
| "gen-c-header" | "inspect" | "init" | "run" | "run2" | "self-update" | "validate"
| "wast" | "binfmt" | "list" | "login" | "publish" => WasmerCLIOptions::parse(),
| "gen-c-header" | "inspect" | "init" | "run" | "run-unstable" | "self-update"
| "validate" | "wast" | "binfmt" | "list" | "login" | "publish" => {
WasmerCLIOptions::parse()
}
_ => {
WasmerCLIOptions::try_parse_from(args.iter()).unwrap_or_else(|e| {
match e.kind() {
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod list;
mod login;
mod publish;
mod run;
mod run2;
mod run_unstable;
mod self_update;
mod validate;
#[cfg(feature = "wast")]
Expand All @@ -35,7 +35,7 @@ pub use create_exe::*;
pub use wast::*;
pub use {
add::*, cache::*, config::*, init::*, inspect::*, list::*, login::*, publish::*, run::*,
run2::Run2, self_update::*, validate::*, whoami::*,
run_unstable::RunUnstable, self_update::*, validate::*, whoami::*,
};
#[cfg(feature = "static-artifact-create")]
pub use {create_obj::*, gen_c_header::*};
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use crate::{
wasmer_home::{DownloadCached, ModuleCache, WasmerHome},
};

/// The `wasmer run` subcommand.
/// The unstable `wasmer run` subcommand.
#[derive(Debug, Parser)]
pub struct Run2 {
pub struct RunUnstable {
#[clap(flatten)]
verbosity: clap_verbosity_flag::Verbosity<WarnLevel>,
#[clap(flatten)]
Expand All @@ -60,7 +60,7 @@ pub struct Run2 {
args: Vec<String>,
}

impl Run2 {
impl RunUnstable {
pub fn execute(&self) -> Result<(), Error> {
crate::logging::set_up_logging(self.verbosity.log_level_filter());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod webc_on_disk {
#[test]
fn wasi_runner() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::qjs())
.arg("--")
.arg("--eval")
Expand All @@ -40,7 +40,7 @@ mod webc_on_disk {
std::fs::write(temp.path().join("index.js"), "console.log('Hello, World!')").unwrap();

let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::qjs())
.arg(format!("--mapdir=/app:{}", temp.path().display()))
.arg("--")
Expand All @@ -57,7 +57,7 @@ mod webc_on_disk {
std::fs::write(temp.path().join("main.py"), "print('Hello, World!')").unwrap();

let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::python())
.arg(format!("--mapdir=/app:{}", temp.path().display()))
.arg("--")
Expand All @@ -70,7 +70,7 @@ mod webc_on_disk {
#[test]
fn webc_files_with_multiple_commands_require_an_entrypoint_flag() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::wabt())
.assert();

Expand All @@ -81,7 +81,7 @@ mod webc_on_disk {
#[test]
fn wasi_runner_with_env_vars() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::python())
.arg("--env=SOME_VAR=Hello, World!")
.arg("--")
Expand All @@ -98,7 +98,7 @@ mod webc_on_disk {
// Start the WCGI server in the background
let port = rand::thread_rng().gen_range(10_000_u16..u16::MAX);
let mut cmd = std::process::Command::new(get_wasmer_path());
cmd.arg("run2")
cmd.arg("run-unstable")
.arg(format!("--addr=127.0.0.1:{port}"))
.arg(fixtures::static_server())
.env("RUST_LOG", RUST_LOG);
Expand Down Expand Up @@ -129,7 +129,7 @@ mod webc_on_disk {
// Start the WCGI server in the background
let port = rand::thread_rng().gen_range(10_000_u16..u16::MAX);
let mut cmd = std::process::Command::new(get_wasmer_path());
cmd.arg("run2")
cmd.arg("run-unstable")
.arg(format!("--addr=127.0.0.1:{port}"))
.arg(format!("--mapdir=/path/to:{}", temp.path().display()))
.arg(fixtures::static_server())
Expand Down Expand Up @@ -157,7 +157,7 @@ mod wasm_on_disk {
#[test]
fn wasi_executable() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::qjs())
.arg("--")
.arg("--eval")
Expand All @@ -170,7 +170,7 @@ mod wasm_on_disk {
#[test]
fn no_abi() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::fib())
.assert();

Expand All @@ -180,7 +180,7 @@ mod wasm_on_disk {
#[test]
fn error_if_no_start_function_found() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(fixtures::wat_no_start())
.assert();

Expand All @@ -206,7 +206,7 @@ mod wasm_on_disk {

// Now we can try to run the compiled artifact
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(&dest)
.arg("--")
.arg("--eval")
Expand All @@ -224,7 +224,7 @@ fn wasmer_package_directory() {
std::fs::copy(fixtures::qjs_wasmer_toml(), temp.path().join("wasmer.toml")).unwrap();

let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg(temp.path())
.arg("--")
.arg("--eval")
Expand All @@ -240,7 +240,7 @@ mod remote_webc {
#[test]
fn quickjs_as_package_name() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg("saghul/quickjs")
.arg("--entrypoint=quickjs")
.arg("--registry=https://wapm.io/")
Expand All @@ -255,7 +255,7 @@ mod remote_webc {
#[test]
fn quickjs_as_url() {
let assert = Command::new(get_wasmer_path())
.arg("run2")
.arg("run-unstable")
.arg("https://wapm.io/saghul/quickjs")
.arg("--entrypoint=quickjs")
.arg("--")
Expand Down

0 comments on commit 60fcba4

Please sign in to comment.