bytecodealliance / wasm-tools

CLI and Rust libraries for low-level manipulation of WebAssembly modules
Apache License 2.0
1.21k stars 224 forks source link

wasm-tools, wit-parser: add --all-features to enable all features gated with @unstable #1599

Closed ydnar closed 3 weeks ago

ydnar commented 3 weeks ago

This PR adds the --all-features option to wasm-tools component, primarily so wasm-tools component wit -j can emit a JSON representation of the original WIT with all @unstable gated features intact.

It additionally adds support for --features . as an alias for --all-features.

Originally proposed here: https://bytecodealliance.zulipchat.com/#narrow/stream/327223-wit-bindgen/topic/wit-parser.20crate.3A.20JSON.20format.20changes/near/443516048

ydnar commented 3 weeks ago

Thanks! Can you elaborate on why to support --features . though? I've not personally seen precedent for something like that and it feels a bit odd to me that . means "everything". I'd personally be in favor of just sticking with --all-features myself.

. for everything mimics regexp syntax, and Go uses . to mean "all" in a number of contexts in its CLI.

Happy to revert this if that’s what gets it done.

alexcrichton commented 3 weeks ago

That's true about regexes, although I'd expect .* to match all features as opposed to just . for regexes. Would you be ok dropping --features . and just keeping --all-features?