-
-
Notifications
You must be signed in to change notification settings - Fork 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
Example code of README.md using builder pattern results in panic #1965
Comments
After some research it looks like the field arg.name is always So assert!(
two_args_of(|x| x.name == arg.name).is_none(),
"Argument names must be unique, but '{}' is in use by more than one argument or group",
arg.name,
); returns always a Due to my still little knowledge of Rust i'd be happy to help and learn. impl<'help> Arg<'help> {
/// @TODO @p2 @docs @v3-beta1: Write Docs
pub fn new<T: Key + ToString>(t: T) -> Self {
Arg {
id: t.into(),
disp_ord: 999,
unified_ord: 999,
..Default::default()
}
}
} which is lacking a name field too. |
In the first snippet, the condition must be Where did you get the second snippet from? I can't find it in the codebase. |
I don't get it. Our tests should be failing if the condition is wrong.
…On Mon, Jun 8, 2020, 13:55 CreepySkeleton ***@***.***> wrote:
In the first snippet, the condition must be x.id == arg.id.
Where did you get the second snippet from? I can't find it in the codebase.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1965 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABKU356EBAPR4DDAIDJSZ3RVTGSDANCNFSM4NX7WYWA>
.
|
Hello @CreepySkeleton , |
Ah, yes. There used to be This is fixed in master. The condition must be fixed though - it's not wrong, but it would be "more correct" to check |
Alright. |
Make sure you completed the following tasks
Code
Steps to reproduce the issue
cargo run
Version
Actual Behavior Summary
If i use the above example code from the clap-rs README.md i get a
thread 'main' panicked at 'Argument names must be unique, but '' is in use by more than one argument or group'
Expected Behavior Summary
I think this should happen instead.
error: The following required arguments were not provided:
USAGE:
clap_bug [FLAGS] [OPTIONS] [SUBCOMMAND]
Additional context
Debug output
Compile clap with
debug
feature:The output may be very long, so feel free to link to a gist or attach a text file
Debug Output
The text was updated successfully, but these errors were encountered: