cargo-wasi icon indicating copy to clipboard operation
cargo-wasi copied to clipboard

impemented --runtime-args flag

Open ibaryshnikov opened this issue 5 years ago • 1 comments

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

ibaryshnikov avatar Nov 16 '19 00:11 ibaryshnikov

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.

alexcrichton avatar Dec 02 '19 15:12 alexcrichton