tauri-apps / tauri-apps/plugins-workspace
[feat][plugin-cli] support parsing unconfigured argmuents
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
In `clap`, there are two options for positional args which I found quite useful, they are [`allow_hyphen_values`](https://docs.rs/clap/latest/clap/struct.Arg.html#method.allow_hyphen_values) and [`trailing_var_arg`](https://docs.rs/clap/latest/clap/struct.Arg.html#method.trailing_var_arg). Which make it easy to parse arguments that are not per-configured.
## Why
Let's say I'm writing a GUI wrapper to another program that has many CLI options, and I want the user to start my program with the same options of that other program (i.e. `cargo`).
So if the user run `my-program build --vcs none --lib --edition 2024 -v hello_world`, I want the parser to collect all arguments after `build` without me redefine all those same options.
In `clap`, I can use something like this:
```rust
enum Subcommands {
Build {
#[arg(
trailing_var_arg = true,
allow_hyphen_values = true,
value_name = "ARGS"
)]
extra_args: Vec,
}
}
```
But I don't know if its possible to do the same thing using the `cli` plugin
Contributor guide
Assessment
This issue has not been assessed yet.