cargo-wasi
cargo-wasi copied to clipboard
impemented --runtime-args flag
This pr adds the ability to pass arguments to runtime using --runtime-args
flag.
At the moment I made a naive implementation of split_args
function to separate arguments intended for binary from ones intended for runtime. Is it planned to use a library like clap
or structopt
? It may simplify the work with arguments a bit
Closes #17
So the main thing to handle here is definitely the option parsing. We'll want to be careful to not do this with simple string iteration but to instead us some form of an argument parser. For example, although weird, something could look like --pass-as-an-argument "--runtime-args"
and we'd accidentally misinterpret that.
The easiest, although still difficult, solution that I can think of is to copy Cargo's help text and option parsing into cargo wasi
. We'd then augment it with --runtime-args
for the run
/bench
/test
/etc cases and would use that option parser to read off the information.