-
-
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
Don't collapse optional positional arguments into [ARGS]
in the usage string
#769
Comments
I do agree, but at the same time I worry about applications that have lots of positional arguments. I'd like to get some others opinions on this issue before merging. One point I'd like to change from your proposal though is the I'd prefer that go to |
Oh, I meant to mention that I'd be fine with not nesting the square brackets. Not sure what the best option is for handling lots of optional positional arguments, but the same problem already exists for required positional arguments, so a common solution would be nice. |
So we already don't collapse them down if it's only 2 positional arguments (I believe...I can't remember 😜 ). So it's entirely possible that we only collapse them after only after a [higher] certain number (perhaps up the number to...5?). |
They're collapsed to [ARGS] if there are two or more. I guess I could live with collapsing only if there are more than X items, or even just an option that allows me to just disable it altogether. |
Adding an option to just disable the collapsing is easy, and I think the route I'll go since that won't mess with current usage strings (i.e. it's an opt-in feature). |
The setting was added to resolve clap-rs#769. The reason it was optional is out of concern for applications with a lot of positional arguments. I think those cases are rare enough that we should just push people to override the usage. Positional arguments are generally important enough, even if optional, to show. As a side effect, this fixed some bugs with `dont_collapse_args_in_usage` where it would repeat an argument in a smart usage. As a side effect, smart usage now shows `--` when it should
The setting was added to resolve clap-rs#769. The reason it was optional is out of concern for applications with a lot of positional arguments. I think those cases are rare enough that we should just push people to override the usage. Positional arguments are generally important enough, even if optional, to show. As a side effect, this fixed some bugs with `dont_collapse_args_in_usage` where it would repeat an argument in a smart usage. As a side effect, smart usage now shows `--` when it should
Rust Version
rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
Affected Version of clap
2.19.1
Expected Behavior Summary
If I have one required and two optional positional arguments, I expect the usage string to say:
to properly represent the order in which the arguments need to be given.
Actual Behavior Summary
The optional positional arguments are collapsed into a single
[ARGS]
placeholder, and I have to look at theARGS
block and know it tells me the required order.Steps to Reproduce the issue
Run the program with
--help
.Sample Code or Link to Sample Code
The text was updated successfully, but these errors were encountered: