Skip to content

Commit

Permalink
Simplify default run logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed Nov 20, 2019
1 parent 1685455 commit cb7fcb9
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,20 +842,8 @@ fn get_compiler_by_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
}

fn main() {
let options = {
let args: Vec<String> = 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"))]
Expand Down

0 comments on commit cb7fcb9

Please sign in to comment.