You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used to use wasm-nm (src) to get the symbol table from a Wasm file. It's basically the UNIX nm but for Wasms. Unfortunately wasm-nm is unmaintained and doesn't work on recent Wasm files that have new instructions.
Thankfully ic-wasm info also provides the list of exported functions and it works with recent wasms, so that is great. My only minor gripe is that the output is not very machine readable. I have to parse it with sed and if ever you change the format, those sed scripts might well break.
Would you be open to providing a machine readable output? For example, ic-wasm info --json so that the output can be parsed with jq?
If so, I would be happy to provide a PR to do this. I would propose to gather all the info collected here into a struct. On that struct I would have a to_string() method that provides output identical to the current output. I would then add the option of serializing that struct as JSON instead.
What do you think?
The text was updated successfully, but these errors were encountered:
Sounds good to me. The current output is for human only, so we don't even need to keep the current format. Feel free to adjust the format as you see fit.
# Motivation
The output of `ic-wasm info` is useful but not reliably machine readable. See #51 for more details.
# Changes
- Add a `--json` flag to `ic-wasm info`.
- Define a structure for the Wasm info and define Display and JSON Serialize traits on that structure.
- The Display output matches the existing output exactly.
- The JSON output provides the same data but in machine readable format.
# Tests
- The existing test for human readable output passes with no changes.
- A similar test has been added for JSON output.
First off, thank you for a useful project.
I used to use
wasm-nm
(src) to get the symbol table from a Wasm file. It's basically the UNIXnm
but for Wasms. Unfortunatelywasm-nm
is unmaintained and doesn't work on recent Wasm files that have new instructions.Thankfully
ic-wasm info
also provides the list of exported functions and it works with recent wasms, so that is great. My only minor gripe is that the output is not very machine readable. I have to parse it withsed
and if ever you change the format, thosesed
scripts might well break.Would you be open to providing a machine readable output? For example,
ic-wasm info --json
so that the output can be parsed withjq
?If so, I would be happy to provide a PR to do this. I would propose to gather all the info collected here into a struct. On that struct I would have a
to_string()
method that provides output identical to the current output. I would then add the option of serializing that struct as JSON instead.What do you think?
The text was updated successfully, but these errors were encountered: