From cb7fcb94522d8b9b43d9322800553d81578555d7 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Wed, 20 Nov 2019 14:59:55 -0800 Subject: [PATCH] Simplify default run logic --- src/bin/wasmer.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 012758504..ef3ea2d9e 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -842,20 +842,8 @@ 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 - _ => { - let run_options = Run::from_args(); - CLIOptions::Run(run_options) - } - } - }; + let options = StructOpt::from_iter_safe(env::args()) + .unwrap_or_else(|_| CLIOptions::Run(Run::from_args())); match options { CLIOptions::Run(options) => run(options), #[cfg(not(target_os = "windows"))]