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

Could the setting and requiring value delimiter automatically reflect in the help messages? #1052

Closed
zolnov opened this issue Sep 20, 2017 · 1 comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations E-medium Call for participation: Experience needed to fix: Medium / intermediate
Milestone

Comments

@zolnov
Copy link

zolnov commented Sep 20, 2017

Rust Version

  • rustc 1.20.0 (f3d6973f4 2017-08-27)

Affected Version of clap

  • clap 2.26.2

Expected Behavior Summary

Set some required delimiter:

.arg(
            Arg::with_name("volume")
            .short("v")
            .long("volume")
            .value_names(&["SOURCE","DESTINATION"])
            .value_delimiter(":")
            .require_delimiter(true)
            .takes_value(true)
     )

Help could show it:

-v, --volume <SOURCE>:<DESTINATION>

And if I run the code with space delimiter, clap could warn me to use ":" instead!

Actual Behavior Summary

Helps shows space delimiter:

-v, --volume <SOURCE> <DESTINATION>

Running with space delimiter it gives error, without the correct hint about what went wrong:

./prog -v a b
error: Found argument 'b' which wasn't expected, or isn't valid in this context

USAGE:
    prog --volume <SOURCE> <DESTINATION>

It gives error but does not show me to use ":" between a and b to get the correct behavior.

@kbknapp
Copy link
Member

kbknapp commented Oct 4, 2017

Yes it could. This would be a quick and easy PR if someone is interested!

Relevant lines

@kbknapp kbknapp added A-help Area: documentation, including docs.rs, readme, examples, etc... D: easy E-medium Call for participation: Experience needed to fix: Medium / intermediate C-enhancement Category: Raise on the bar on expectations labels Oct 4, 2017
@kbknapp kbknapp added this to the 2.27.0 milestone Oct 12, 2017
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-enhancement Category: Raise on the bar on expectations E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

No branches or pull requests

2 participants