how to pass command flags to wasm packages' binary
chawyehsu opened this issue · 2 comments
chawyehsu commented
Summary
For instance, I want to pass command flag --help
to cowsay
to show help page of cowsay, then I want to pass a --list
flag to print all type of cows that cowsay has.
I tried cowsay --help
, but it prints wapm-cli's help page:
❯ cowsay --help
C:[omitted]>wapm run cowsay --help
wapm.exe-run 0.5.0
Run a command from the package or one of the dependencies
USAGE:
wapm.exe run [OPTIONS] <command> [--] [args]...
FLAGS:
-h, --help Prints help information
OPTIONS:
--dir <pre-opened-directories>... WASI pre-opened directory
ARGS:
<command> Command name
<args>... Application arguments
Then I tried wapm run cowsay -h
, and wapm run cowsay -- --help
, using --
to force pass flags, and both of these two commands display the same output as above.
After that, I tried to execute cowsay.wasm with wasmer-cli directly:
❯ wasmer.exe cowsay.wasm --help
wasmer-cli 1.0.2
WASI Options
USAGE:
wasmer.exe [FLAGS] [OPTIONS] <FILE> [--] [--]...
FLAGS:
--enable-all Enable support for all pre-standard proposals
--enable-bulk-memory Enable support for the bulk memory proposal
--cranelift Use Cranelift compiler
--disable-cache Disable the cache
--enable-verifier Enable compiler internal verification
-h, --help Prints help information
--jit Use JIT Engine
--llvm Use LLVM compiler
...
It prints the help page of wasmer-cli... I tried the last one:
❯ wasmer.exe cowsay.wasm -- --help
cowsay v0.1.0
Syrus Akbary <syrus@wasmer.io>
USAGE:
cowsay.wasm [FLAGS] [OPTIONS] [MESSAGE]...
FLAGS:
-b Borg Cow
-d Dead Cow
-g Greedy Cow
-h, --help Prints help information
-l, --list List Cows
-n Disable word wrap
-p Paranoid Cow
--random Choose random cow
-s Stoned Cow
-t Tired Cow
-V, --version Prints version information
-w Wired Cow
-y Youthful Cow
OPTIONS:
-f <COW> Which cow should say
-e <EYE_STRING> Custom Eyes
-T <TONGUE_STRING> Custom Tongue
-W <WIDTH> Max width of cow text bubble
ARGS:
<MESSAGE>... Message for cow to say
This time it prints cowsay's help finally. I'm so confused about it.
chawyehsu commented
Oh I forget to try cowsay -- --help
which actually works, never mind.