mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 05:08:19 +00:00
Revert update to clap-beta back to structopt
Clap-beta hasn't had a release in a while and likely won't for a while longer. We're affected by bugs that have been fixed and not released. We shouldn't be depending on beta software anyways for this.
This commit is contained in:
@@ -10,16 +10,16 @@ use crate::commands::{Cache, Config, Inspect, Run, SelfUpdate, Validate};
|
||||
use crate::error::PrettyError;
|
||||
use anyhow::Result;
|
||||
|
||||
use clap::{Clap, ErrorKind};
|
||||
use structopt::{clap::ErrorKind, StructOpt};
|
||||
|
||||
#[derive(Clap)]
|
||||
#[derive(StructOpt)]
|
||||
#[cfg_attr(
|
||||
not(feature = "headless"),
|
||||
clap(name = "wasmer", about = "WebAssembly standalone runtime.", author)
|
||||
structopt(name = "wasmer", about = "WebAssembly standalone runtime.", author)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "headless",
|
||||
clap(
|
||||
structopt(
|
||||
name = "wasmer-headless",
|
||||
about = "Headless WebAssembly standalone runtime.",
|
||||
author
|
||||
@@ -28,43 +28,43 @@ use clap::{Clap, ErrorKind};
|
||||
/// The options for the wasmer Command Line Interface
|
||||
enum WasmerCLIOptions {
|
||||
/// Run a WebAssembly file. Formats accepted: wasm, wat
|
||||
#[clap(name = "run")]
|
||||
#[structopt(name = "run")]
|
||||
Run(Run),
|
||||
|
||||
/// Wasmer cache
|
||||
#[clap(name = "cache")]
|
||||
#[structopt(name = "cache")]
|
||||
Cache(Cache),
|
||||
|
||||
/// Validate a WebAssembly binary
|
||||
#[clap(name = "validate")]
|
||||
#[structopt(name = "validate")]
|
||||
Validate(Validate),
|
||||
|
||||
/// Compile a WebAssembly binary
|
||||
#[cfg(feature = "compiler")]
|
||||
#[clap(name = "compile")]
|
||||
#[structopt(name = "compile")]
|
||||
Compile(Compile),
|
||||
|
||||
/// Compile a WebAssembly binary into a native executable
|
||||
#[cfg(all(feature = "staticlib", feature = "compiler"))]
|
||||
#[clap(name = "create-exe")]
|
||||
#[structopt(name = "create-exe")]
|
||||
CreateExe(CreateExe),
|
||||
|
||||
/// Get various configuration information needed
|
||||
/// to compile programs which use Wasmer
|
||||
#[clap(name = "config")]
|
||||
#[structopt(name = "config")]
|
||||
Config(Config),
|
||||
|
||||
/// Update wasmer to the latest version
|
||||
#[clap(name = "self-update")]
|
||||
#[structopt(name = "self-update")]
|
||||
SelfUpdate(SelfUpdate),
|
||||
|
||||
/// Inspect a WebAssembly file
|
||||
#[clap(name = "inspect")]
|
||||
#[structopt(name = "inspect")]
|
||||
Inspect(Inspect),
|
||||
|
||||
/// Run spec testsuite
|
||||
#[cfg(feature = "wast")]
|
||||
#[clap(name = "wast")]
|
||||
#[structopt(name = "wast")]
|
||||
Wast(Wast),
|
||||
}
|
||||
|
||||
@@ -101,15 +101,15 @@ pub fn wasmer_main() {
|
||||
let command = args.get(1);
|
||||
let options = match command.unwrap_or(&"".to_string()).as_ref() {
|
||||
"cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run"
|
||||
| "self-update" | "validate" | "wast" => WasmerCLIOptions::parse(),
|
||||
| "self-update" | "validate" | "wast" => WasmerCLIOptions::from_args(),
|
||||
_ => {
|
||||
WasmerCLIOptions::try_parse_from(args.iter()).unwrap_or_else(|e| {
|
||||
WasmerCLIOptions::from_iter_safe(args.iter()).unwrap_or_else(|e| {
|
||||
match e.kind {
|
||||
// This fixes a issue that:
|
||||
// 1. Shows the version twice when doing `wasmer -V`
|
||||
// 2. Shows the run help (instead of normal help) when doing `wasmer --help`
|
||||
ErrorKind::DisplayVersion | ErrorKind::DisplayHelp => e.exit(),
|
||||
_ => WasmerCLIOptions::Run(Run::parse()),
|
||||
ErrorKind::VersionDisplayed | ErrorKind::HelpDisplayed => e.exit(),
|
||||
_ => WasmerCLIOptions::Run(Run::from_args()),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user