Skip to content

Name duplicate option value #1936

Answered by CreepySkeleton
bjeanes asked this question in Q&A
Discussion options

You must be logged in to vote

The more I think about this, the more I'm assured that clap uses wrong terminology here. You see, the string you pass to Arg::new() constructor (#[clap(name = "...")] attr) isn't exactly the name of the argument but rather identifier. Due to the way arguments are stored and processed, this identifier MUST be unique at all times. This is basically an invariant that must be upheld. I'm actually writing "clap book" that will cover this topic.

Help/error messages is a different topic. How clap decides what to print in -F <WHAT??>? Most of the time, it uses the identifier because this is the most common case: the string you pass into Arg::new is very likely the fitting name for the value. But …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bjeanes
Comment options

@bjeanes
Comment options

Answer selected by pksunkara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants