Skip to content
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

Wrong usage string for trailing varargs #298

Closed
matklad opened this issue Oct 1, 2015 · 4 comments
Closed

Wrong usage string for trailing varargs #298

matklad opened this issue Oct 1, 2015 · 4 comments
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies
Milestone

Comments

@matklad
Copy link
Contributor

matklad commented Oct 1, 2015

For the following code

        .args_from_usage(
            "[daemon] -d   'Daemonizes the container'
             --cpu [PREC]  'set CPU usage limit'
             <IMAGE_PATH>  'path to image of container file system'
             <CMD>         'command to run inside the container'
             [ARGS]...     'arguments to pass to the CMD'")

I get this usage string: aucont_start [FLAGS] [OPTIONS] [ARGS] <IMAGE_PATH> <CMD>.
[ARGS] should definitely come after IMAGE_PATH and CMD in the usage string. The parsing itself works correctly.

@kbknapp
Copy link
Member

kbknapp commented Oct 1, 2015

Thanks for taking the time to file this! I can confirm, on 1.4.3 this is the case. I believe this may be a bug in the usage generation portion because in cases like the above it should be:

USAGE:
    aucont_start [FLAGS] [OPTIONS] <IMAGE_PATH> <CMD> [--] [ARGS]

Note, you can also override the usage string to make it anything you like, but doing so manes you no longer get context aware usage strings generated on error messages. This doesn't appear to be a good case for that, but just FYI.

We'll report back here once this bug is fixed 👍

@kbknapp kbknapp added C-bug Category: Updating dependencies P2: need to have A-help Area: documentation, including docs.rs, readme, examples, etc... labels Oct 1, 2015
@kbknapp kbknapp added this to the 1.4.4 milestone Oct 1, 2015
@kbknapp
Copy link
Member

kbknapp commented Oct 1, 2015

Also, this is somewhat muddled by the use of ARGS for the argument name, and claps use of [ARGS] in regular usage strings just to denote "optional positional arguments." It's not a big deal, but just something to be aware of.

@matklad
Copy link
Contributor Author

matklad commented Oct 1, 2015

Thanks for the swift reply! I'd like to add that implementing #278 would be ideal for my use case :)

@kbknapp
Copy link
Member

kbknapp commented Oct 1, 2015

That's actually what I'm working on now, and should be implemented shortly :)

homu added a commit that referenced this issue Oct 1, 2015
fix(Usage Strings): fixes a bug ordering of elements in usage strings

Closes #298
@homu homu closed this as completed in #299 Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants