-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple values in native completions #3921
Comments
I have added support to complete multiple values for flags. clap/clap_builder/src/parser/parser.rs Lines 289 to 404 in 6b18d77
|
Another relevant piece of code is clap/clap_builder/src/builder/debug_asserts.rs Lines 487 to 674 in 6b18d77
Positionals must either be
I might be missing some corner cases in there but that is also likely the order of importance for supporting this. We can start with just |
Command line:
will report an error:
How should I use this cli? |
Huh, looks like something isn't working quite right. I even tried throwing in Updated code #!/usr/bin/env nargo
---
[dependencies]
clap = { path = "../clap", features = ["derive"] }
---
use clap::Parser;
use clap::builder::ArgAction;
#[derive(Parser, Debug)]
#[command(name = "dynamic", about = "A dynamic command line tool")]
struct Cli {
#[arg(value_parser = ["pos_a"], num_args = 2, action = ArgAction::Set, required = true)]
positional_a: Vec<String>,
#[arg(value_parser = ["pos_b"], num_args = 2, action = ArgAction::Set, required = true)]
positional_b: Vec<String>,
#[arg(value_parser = ["pos_c"], num_args = 2, action = ArgAction::Set, last = true)]
positional_c: Vec<String>,
#[arg(short, long, action = ArgAction::Count)]
divider: u8,
}
fn main() {
let cli = Cli::parse();
print!("{cli:?}");
} |
Is it possible that positional arguments were not designed to be used this way (multiple positional arguments with |
Some thought was put into positionals and |
#5601 got us multi-value support. It left out
By controlling the scope of this issue, it looks like we can close it out. |
Blocked on #3920
Both for flags and positional arguments
Tasks
The text was updated successfully, but these errors were encountered: