dfinity / dfinity/ic-wasm

Machine readable info

Open
#51 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
120
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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 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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/info.rs and the existing output path for ic-wasm info, focusing on the information currently collected there. Add a shared representation that preserves the current text output and supports an --json mode; done means both formats expose the same information and the JSON can be consumed by tools such as jq.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.