mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
style: changes values->possible values in help messages as well as errors
This commit is contained in:
parent
973022184e
commit
08dfdc877b
2 changed files with 11 additions and 11 deletions
|
@ -540,14 +540,14 @@ impl<'w> Help<'w> {
|
||||||
debugln!("Help::spec_vals: Found possible vals...{:?}", pv);
|
debugln!("Help::spec_vals: Found possible vals...{:?}", pv);
|
||||||
spec_vals.push(if self.color {
|
spec_vals.push(if self.color {
|
||||||
format!(
|
format!(
|
||||||
" [values: {}]",
|
" [possible values: {}]",
|
||||||
pv.iter()
|
pv.iter()
|
||||||
.map(|v| format!("{}", self.cizer.good(v)))
|
.map(|v| format!("{}", self.cizer.good(v)))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ")
|
.join(", ")
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
format!(" [values: {}]", pv.join(", "))
|
format!(" [possible values: {}]", pv.join(", "))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ FLAGS:
|
||||||
-V, --version Prints version information
|
-V, --version Prints version information
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-O, --Option <option3> specific vals [values: fast, slow]
|
-O, --Option <option3> specific vals [possible values: fast, slow]
|
||||||
--long-option-2 <option2> tests long options with exclusions
|
--long-option-2 <option2> tests long options with exclusions
|
||||||
--maxvals3 <maxvals>... Tests 3 max vals
|
--maxvals3 <maxvals>... Tests 3 max vals
|
||||||
--minvals2 <minvals>... Tests 2 min vals
|
--minvals2 <minvals>... Tests 2 min vals
|
||||||
|
@ -45,7 +45,7 @@ OPTIONS:
|
||||||
ARGS:
|
ARGS:
|
||||||
<positional> tests positionals
|
<positional> tests positionals
|
||||||
<positional2> tests positionals with exclusions
|
<positional2> tests positionals with exclusions
|
||||||
<positional3>... tests specific values [values: vi, emacs]
|
<positional3>... tests specific values [possible values: vi, emacs]
|
||||||
|
|
||||||
SUBCOMMANDS:
|
SUBCOMMANDS:
|
||||||
help Prints this message or the help of the given subcommand(s)
|
help Prints this message or the help of the given subcommand(s)
|
||||||
|
@ -244,7 +244,7 @@ FLAGS:
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
|
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
|
||||||
-p, --pos <VAL> Some vals [values: fast, slow]";
|
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||||
|
|
||||||
static FINAL_WORD_WRAPPING: &'static str = "ctest 0.1
|
static FINAL_WORD_WRAPPING: &'static str = "ctest 0.1
|
||||||
|
|
||||||
|
@ -299,8 +299,8 @@ FLAGS:
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle
|
--filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle
|
||||||
images. The default is Linear (Bilinear). [values: Nearest, Linear, Cubic, Gaussian,
|
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic,
|
||||||
Lanczos3]";
|
Gaussian, Lanczos3]";
|
||||||
|
|
||||||
static ISSUE_702: &'static str = "myapp 1.0
|
static ISSUE_702: &'static str = "myapp 1.0
|
||||||
foo
|
foo
|
||||||
|
@ -501,7 +501,7 @@ FLAGS:
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
|
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
|
||||||
-p, --pos <VAL> Some vals [values: fast, slow]";
|
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||||
|
|
||||||
static SHOW_ENV_VALS: &'static str = "ctest 0.1
|
static SHOW_ENV_VALS: &'static str = "ctest 0.1
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ FLAGS:
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||||
-p, --pos <VAL> Some vals [values: fast, slow]";
|
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||||
|
|
||||||
fn setup() -> App<'static, 'static> {
|
fn setup() -> App<'static, 'static> {
|
||||||
App::new("test")
|
App::new("test")
|
||||||
|
@ -877,7 +877,7 @@ fn issue_688_hidden_pos_vals() {
|
||||||
.setting(AppSettings::HidePossibleValuesInHelp)
|
.setting(AppSettings::HidePossibleValuesInHelp)
|
||||||
.arg(Arg::with_name("filter")
|
.arg(Arg::with_name("filter")
|
||||||
.help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \
|
.help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \
|
||||||
images. The default is Linear (Bilinear). [values: Nearest, Linear, Cubic, Gaussian, Lanczos3]")
|
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic, Gaussian, Lanczos3]")
|
||||||
.long("filter")
|
.long("filter")
|
||||||
.possible_values(&filter_values)
|
.possible_values(&filter_values)
|
||||||
.takes_value(true));
|
.takes_value(true));
|
||||||
|
@ -899,7 +899,7 @@ fn issue_688_hidden_pos_vals() {
|
||||||
.set_term_width(120)
|
.set_term_width(120)
|
||||||
.arg(Arg::with_name("filter")
|
.arg(Arg::with_name("filter")
|
||||||
.help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \
|
.help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \
|
||||||
images. The default is Linear (Bilinear). [values: Nearest, Linear, Cubic, Gaussian, Lanczos3]")
|
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic, Gaussian, Lanczos3]")
|
||||||
.long("filter")
|
.long("filter")
|
||||||
.takes_value(true));
|
.takes_value(true));
|
||||||
assert!(test::compare_output(app3, "ctest --help", ISSUE_688, false));
|
assert!(test::compare_output(app3, "ctest --help", ISSUE_688, false));
|
||||||
|
|
Loading…
Reference in a new issue