Skip to content

Commit

Permalink
Merge branch 'master' into fix_singlepass_macm1
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb authored Dec 8, 2022
2 parents 51710a1 + ef8d2f6 commit 2afef71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/c-api/src/wasm_c_api/types/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct wasm_importtype_t {
}

wasm_declare_boxed_vec!(importtype);
wasm_impl_copy!(importtype);

#[no_mangle]
pub extern "C" fn wasm_importtype_new(
Expand Down
17 changes: 14 additions & 3 deletions lib/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,20 @@ pub fn get_executable_file_from_path(
Some(s) => commands.iter().find(|c| c.get_name() == s).ok_or_else(|| {
anyhow::anyhow!("Cannot run {name}@{version}: package has no command {s:?}")
})?,
None => commands.first().ok_or_else(|| {
anyhow::anyhow!("Cannot run {name}@{version}: package has no commands")
})?,
None => {
if commands.is_empty() {
Err(anyhow::anyhow!(
"Cannot run {name}@{version}: package has no commands"
))
} else if commands.len() == 1 {
Ok(&commands[0])
} else {
Err(anyhow::anyhow!(" -> wasmer run {name}@{version} --command-name={0} OR wasmer run {name}@{version}:{0}", commands.first().map(|f| f.get_name()).unwrap()))
.context(anyhow::anyhow!("{}", commands.iter().map(|c| format!("`{}`", c.get_name())).collect::<Vec<_>>().join(", ")))
.context(anyhow::anyhow!("You can run any of those by using the --command-name=COMMAND flag or : postfix"))
.context(anyhow::anyhow!("The `{name}@{version}` package doesn't have a default entrypoint, but has multiple available commands:"))
}?
}
};

let module_name = entrypoint_module.get_module();
Expand Down

0 comments on commit 2afef71

Please sign in to comment.