Allow to do wasmer execution without the run argument

This commit is contained in:
Syrus 2019-11-20 14:50:37 -08:00
parent 3d3636059a
commit 1685455eb6

View File

@ -842,7 +842,20 @@ fn get_compiler_by_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
}
fn main() {
let options = CLIOptions::from_args();
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)
}
}
};
match options {
CLIOptions::Run(options) => run(options),
#[cfg(not(target_os = "windows"))]