diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 012758504e1..356f51a8f1f 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -843,14 +843,9 @@ fn get_compiler_by_backend(backend: Backend) -> Option> { fn main() { let options = { - let args: Vec = env::args().into_iter().filter(|x| !x.starts_with("-")).collect(); - match args.get(1).map_or("", |s| &s) { - // Default - "run" | "cache" | "validate" | "self_update" | "" => { - CLIOptions::from_args() - } - // Wasmer trying to run a file directly - _ => { + match StructOpt::from_iter_safe(env::args()) { + Ok(options) => options, + Err(_) => { let run_options = Run::from_args(); CLIOptions::Run(run_options) }