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

fix(help): Optional arg values in brackets #3347

Merged
merged 1 commit into from Jan 26, 2022
Merged

Conversation

jpgrayson
Copy link
Contributor

When an Arg uses .min_values(0), that arg's value(s) are effectively
optional. This is conventionaly denoted in help messages by wrapping the
arg's values in square brackets. For example:

--foo[=value]
--bar [value]

This kind of argument can be seen in the wild in many git commands; e.g.
git-status(1).

Signed-off-by: Peter Grayson pete@jpgrayson.net

When an Arg uses .min_values(0), that arg's value(s) are effectively
optional. This is conventionaly denoted in help messages by wrapping the
arg's values in square brackets. For example:

    --foo[=value]
    --bar [value]

This kind of argument can be seen in the wild in many git commands; e.g.
git-status(1).

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
src/build/arg/mod.rs Outdated Show resolved Hide resolved
src/output/help.rs Outdated Show resolved Hide resolved
src/output/help.rs Outdated Show resolved Hide resolved
@jpgrayson jpgrayson force-pushed the master branch 2 times, most recently from f44f042 to 7eea7d2 Compare January 26, 2022 20:56
@epage epage merged commit 993d55f into clap-rs:master Jan 26, 2022
@epage
Copy link
Member

epage commented Jan 26, 2022

This is now available in v3.0.13

@jpgrayson
Copy link
Contributor Author

Thanks for your quick handling of this PR, @epage. And also for your stewardship of clap. Getting 3.0 over the finish line is a great accomplishment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants