tauri-apps / tauri-apps/plugins-workspace

[feat][plugin-cli] support parsing unconfigured argmuents

Open
#2,694 0 comments 0 reactions 0 assignees View on GitHub
plugin: cli type: feature request
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.