wasm-yes
yes command implemented in WebAssembly and WASI
Install
This command is distributed from WAPM.
$ wapm install Syuparn/yes
$ wapm run yes | head -n 3
y
y
y
You can also compile wasm manually from wat
file.
$ wasm2wat yes.wat
$ wasmer yes.wasm
y
y
y
...
Usage
Same as the GNU yes
command.
# write `y` infinitely
$ wapm run yes
y
y
y
y
y
...
# write argument instead
$ wapm run yes no!
no!
no!
no!
no!
no!
...
About source code
In order to reduce binary size, yes.wat
is written by hand.
For developers
You can test generated wasm by bats.
# install wat2wasm and bats
$ npm install
# build wasm
$ npx wat2wasm yes.wat
# run test (requires wasmer)
$ npx bats test/yes.bats
✓ yes without argument writes 'y'
✓ yes always writes 'y'
2 tests, 0 failures