mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
fix(did-you-mean): for review
* unknown subcommand message altered to use similar language as is used everywhere around clap. Namely, we say 'invalid' instead of 'unknown' * 'did-you-mean' message separator changed from '. ' to '\n\t' Related to #103
This commit is contained in:
parent
3631de580a
commit
0535cfb0c7
2 changed files with 8 additions and 5 deletions
|
@ -35,18 +35,21 @@ SUBCOMMANDS:
|
|||
help Prints this message
|
||||
subcmd tests subcommands'''
|
||||
|
||||
_sc_dym_usage = '''Subcommand "subcm" is unknown. Did you mean "subcmd" ?
|
||||
_sc_dym_usage = '''Subcommand "subcm" isn't valid
|
||||
\tDid you mean "subcmd" ?
|
||||
USAGE:
|
||||
\tclaptests [POSITIONAL] [FLAGS] [OPTIONS] [SUBCOMMANDS]
|
||||
For more information try --help'''
|
||||
|
||||
_arg_dym_usage = '''The argument --optio isn't valid. Did you mean --option ?
|
||||
_arg_dym_usage = '''The argument --optio isn't valid
|
||||
\tDid you mean --option ?
|
||||
USAGE:
|
||||
\tclaptests
|
||||
For more information try --help'''
|
||||
|
||||
_pv_dym_usage = '''"slo" isn't a valid value for '--Option <option3>'
|
||||
\t[valid values: fast slow]. Did you mean "slow" ?
|
||||
\t[valid values: fast slow]
|
||||
\tDid you mean "slow" ?
|
||||
USAGE:
|
||||
\tclaptests --Option <option3>
|
||||
For more information try --help'''
|
||||
|
|
|
@ -1231,7 +1231,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
I: IntoIterator<Item=&'z T> {
|
||||
match did_you_mean(arg, values) {
|
||||
Some(candidate) => {
|
||||
let mut suffix = ". Did you mean ".to_string();
|
||||
let mut suffix = "\n\tDid you mean ".to_string();
|
||||
match style {
|
||||
DidYouMeanMessageStyle::LongFlag => suffix.push_str("--"),
|
||||
DidYouMeanMessageStyle::EnumValue => suffix.push('"'),
|
||||
|
@ -1371,7 +1371,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
|
||||
if let Some(candidate_subcommand) = did_you_mean(&arg, self.subcommands.keys()) {
|
||||
self.report_error(
|
||||
format!("Subcommand \"{}\" is unknown. Did you mean \"{}\" ?",
|
||||
format!("Subcommand \"{}\" isn't valid\n\tDid you mean \"{}\" ?",
|
||||
arg,
|
||||
candidate_subcommand),
|
||||
true,
|
||||
|
|
Loading…
Reference in a new issue