bytecodealliance / wit-bindgen

A language binding generator for WebAssembly interface types
Apache License 2.0
1.04k stars 196 forks source link

Improvement: print worlds to choose from in the error message for multi-world packages #996

Open tschneidereit opened 5 months ago

tschneidereit commented 5 months ago

When trying to create bindings for a package with multiple worlds, one has to choose which world to target. It'd be great if the error message printed when no choice has been made would print the available options, and ideally also what the option name is for choosing them.

primoly commented 5 months ago

I extended the error message in: https://github.com/bytecodealliance/wasm-tools/pull/1654. This does not fully address the issue about the specific cli option, since this is wit-bindgen specific. This would have to go here: https://github.com/bytecodealliance/wit-bindgen/blob/749bacc556cdb4b67848c723dfbeda0a59dff005/src/bin/wit-bindgen.rs#L185 I don’t know how to best go about this since the select_world method returns an error for other reasons as well.