docs(examples): Highlight possible-values in help

Instead of showing the user how to do things manually, let's make the
contrast in `--help` more obvious by not manually listing the possible
values.
This commit is contained in:
Ed Page 2021-11-11 19:12:19 -06:00
parent 6fc9c7cff4
commit 1f0d86a407

View file

@ -11,20 +11,14 @@ fn main() {
.about("does awesome things")
.arg(
Arg::new("INPUT")
.about("The input file to use") // Note, we don't need to specify
// anything like, "Defaults to..."
// because clap will automatically
// generate that for us, and place
// it in the help text
.about("The input file to use")
.default_value("input.txt")
.index(1),
)
// Next we'll use the Option::unwrap_or method on this "CONFIG" option
.arg(
Arg::new("CONFIG")
// Note that we have to manually include some verbage to the user
// telling them what the default will be.
.about("The config file to use (default is \"config.json\")")
.about("The config file to use")
.short('c')
.takes_value(true),
)