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

Suggestion: Change the output of the possible_values help #1160

Closed
Tracked by #1037
phrohdoh opened this issue Feb 2, 2018 · 3 comments
Closed
Tracked by #1037

Suggestion: Change the output of the possible_values help #1160

phrohdoh opened this issue Feb 2, 2018 · 3 comments
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations E-easy Call for participation: Experience needed to fix: Easy / not much E-medium Call for participation: Experience needed to fix: Medium / intermediate

Comments

@phrohdoh
Copy link

phrohdoh commented Feb 2, 2018

My suggestion is to change [values: ...] to [possible values: ...] to match the builder API.

extern crate clap;
use clap::{App, Arg};

fn main() {
    let matches = App::new("clap_issue_1160")
	.arg(Arg::with_name("myarg").possible_values(&["foo", "bar"]))
	.get_matches();
}
$ cargo run -- qux
error: 'qux' isn't a valid value for '<myarg>'
	[values: bar, foo]


USAGE:
    clap_issue_1160 [myarg]

For more information try --help
$ cargo run -- --help
clap_issue_1160

USAGE:
    clap_issue_1160 [myarg]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <myarg>     [values: foo, bar]
@kbknapp
Copy link
Member

kbknapp commented Feb 3, 2018

I'm not against this, my only thinking is it makes the lines longer and I try to stick to no wrapping by default if possible on 80-100 width terminals. Having said that, if someone is using several values already, they're probably already wrapping.

I can mark this as mentored and a good first issue if someone wants to take a swing at it.

@kbknapp kbknapp added C-enhancement Category: Raise on the bar on expectations P4: nice to have A-help Area: documentation, including docs.rs, readme, examples, etc... E-medium Call for participation: Experience needed to fix: Medium / intermediate E-easy Call for participation: Experience needed to fix: Easy / not much labels Feb 3, 2018
etopiei pushed a commit to etopiei/clap-rs that referenced this issue Feb 6, 2018
kbknapp added a commit that referenced this issue Feb 6, 2018
@kbknapp
Copy link
Member

kbknapp commented Feb 12, 2018

This should be implemented, thanks to @etopiei 👍

@kbknapp kbknapp closed this as completed Feb 12, 2018
@phrohdoh
Copy link
Author

Woohoo thanks @etopiei! :D

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-easy Call for participation: Experience needed to fix: Easy / not much E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

No branches or pull requests

2 participants