These are chat archives for kbknapp/clap-rs
I'm very new to Rust and Clap as well, so I'm trying to build a little something that helps me getting used to the language.
I'm using clap for creating a CLI and I was wondering the following:
Is it possible to configure and argument that can have #n "properties" which aren't known at compile time?
So for example the CLI is calling another program under the hood and that program may receive program specific options.
$ some-cli --client some-program --clientOpts.foo 'bar' --clientOpts.bar 'foo'
some-program can have different own options, so I'd need something like
--clientOpts that let's me receive options that are specific to the program, but the properties aren't known (
bar might be
booya in a different program)
I first thought
ArgGroup could help here, but it doesn't seem like it.
One way I could imagine this could work is by configuring an argument that can have multiple values but then having those values being in a parsable format.
So for example:
$ cli --clientOptions 'foo=bar' 'bar=foo' 'something=else'
Basically, what I wanna say is:
Take all the options applied via
--clientOptions and pass them onto
--clientOptionsis an unknown size and I also don't really care what those options are.
cli --some-cli-option --another-cli-option -- --some-client-option # everything after -- is passed to the client directly?
Does that work within
cargo run as well?
$ carg run -- foo -- --some-options --another-option