From 463a3a6f56a5ca06cda890fd6fe7f16485ef70a0 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 26 Apr 2026 19:44:34 +0200 Subject: feat: new tinywasm cli Signed-off-by: Henry --- crates/cli/README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'crates/cli/README.md') diff --git a/crates/cli/README.md b/crates/cli/README.md index aa4d0c8..88172c9 100644 --- a/crates/cli/README.md +++ b/crates/cli/README.md @@ -1,13 +1,30 @@ # `tinywasm-cli` -The `tinywasm-cli` crate contains the command line interface for the `tinywasm` project. See [`tinywasm`](https://crates.io/crates/tinywasm) for more information. +The `tinywasm-cli` package installs the `tinywasm` binary for `tinywasm`. See [`tinywasm`](https://crates.io/crates/tinywasm) for the embedding API. It is recommended to use the library directly instead of the CLI. +The crate also exposes reusable helpers such as `tinywasm_cli::wast_runner::WastRunner` so workspace tests can drive the same WAST execution logic directly. + ## Usage ```bash -$ cargo install tinywasm-cli -$ tinywasm-cli --help -$ tinywasm-cli run ./module.wasm -$ tinywasm-cli run ./module.wasm -f add -a i32:1 -a i32:2 +$ cargo install tinywasm-cli --version 0.9.0-alpha.0 --bin tinywasm +$ tinywasm --help +$ tinywasm ./module.wasm +$ tinywasm run --invoke add ./module.wasm 1 2 +$ tinywasm compile ./module.wat -o ./module.twasm +$ tinywasm dump ./module.twasm +$ tinywasm inspect ./module.wasm +$ tinywasm wast ./spec-tests/address.wast ``` + +Notes: + +- `run`, `dump`, and `inspect` accept `.wasm`, `.wat`, and `.twasm` inputs. +- Use `-` as the input path to read a module from stdin. +- Without `--invoke`, `tinywasm` expects the module to have a start function or `_start` export. +- `compile` writes TinyWasm's `twasm` archive format. +- Function invocation arguments are parsed from the export signature, so `tinywasm run --invoke add ./module.wasm 1 2` works without repeating Wasm types on the command line. +- `inspect` uses ANSI colors automatically when writing to a terminal; set `NO_COLOR=1` to disable them. +- Stack flags support both fixed sizes like `--value-stack-size 4096` and dynamic sizes like `--value-stack-dynamic 1024:8192`. +- `wast` is a separate command for WebAssembly spec scripts and accepts files or folders containing `.wast` files. -- cgit v1.3.1