TeXitoi / structopt

Parse command line arguments by defining a struct.
Other
2.7k stars 149 forks source link

Document allow_hyphen_values #496

Closed lefth closed 2 years ago

lefth commented 3 years ago

#[structopt(allow_hyphen_values = true)] should be documented, so it's easier for people to see how to pass negative numbers as arguments. Suggestion: "Allow the argument value to start with a hyphen. Needed if negative numbers will be a valid input."

TeXitoi commented 2 years ago

structopt can't document all clap, the user should read clap documentation.

I accept a PR with an example with allow_hyphen_values, with an intelligible name.

lefth commented 2 years ago

I didn't realize allow_hyphen_values wasn't a structopt option. Indeed, documenting this is not structopt's responsibility.

Would you like a PR that adds a hyperlink to the clap API docs in the raw methods section? I suggest this because as a new user (not having used clap either), I read the full documentation but didn't realize that complex stuff was expected to be done with the clap API. "See also the [link]clap API[/link]" might hammer that point home.

TeXitoi commented 2 years ago

Sure.

We tried to be explicit about that, but if you have any idea to improve the documentation, feel free to open a PR.