mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
Show arguments in conflict message in reverse order of input
This commit is contained in:
parent
97149e37f5
commit
27771ceeb7
2 changed files with 7 additions and 7 deletions
|
@ -211,8 +211,8 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
|
||||||
};
|
};
|
||||||
let usg = self.build_conflict_err_usage(matcher, former_arg, latter);
|
let usg = self.build_conflict_err_usage(matcher, former_arg, latter);
|
||||||
return Err(Error::argument_conflict(
|
return Err(Error::argument_conflict(
|
||||||
former_arg,
|
latter_arg,
|
||||||
Some(latter_arg.to_string()),
|
Some(former_arg.to_string()),
|
||||||
&*usg,
|
&*usg,
|
||||||
self.p.app.color(),
|
self.p.app.color(),
|
||||||
)?);
|
)?);
|
||||||
|
|
|
@ -2,21 +2,21 @@ mod utils;
|
||||||
|
|
||||||
use clap::{App, Arg, ArgGroup, ErrorKind};
|
use clap::{App, Arg, ArgGroup, ErrorKind};
|
||||||
|
|
||||||
static CONFLICT_ERR: &str = "error: The argument '--flag' cannot be used with '-F'
|
static CONFLICT_ERR: &str = "error: The argument '-F' cannot be used with '--flag'
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
clap-test <positional> <positional2> --flag --long-option-2 <option2>
|
clap-test <positional> <positional2> --flag --long-option-2 <option2>
|
||||||
|
|
||||||
For more information try --help";
|
For more information try --help";
|
||||||
|
|
||||||
static CONFLICT_ERR_REV: &str = "error: The argument '-F' cannot be used with '--flag'
|
static CONFLICT_ERR_REV: &str = "error: The argument '--flag' cannot be used with '-F'
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
clap-test <positional> <positional2> -F --long-option-2 <option2>
|
clap-test <positional> <positional2> -F --long-option-2 <option2>
|
||||||
|
|
||||||
For more information try --help";
|
For more information try --help";
|
||||||
|
|
||||||
static CONFLICT_ERR_THREE: &str = "error: The argument '--one' cannot be used with '--two'
|
static CONFLICT_ERR_THREE: &str = "error: The argument '--two' cannot be used with '--one'
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
three_conflicting_arguments --one
|
three_conflicting_arguments --one
|
||||||
|
@ -190,7 +190,7 @@ fn two_conflicting_arguments() {
|
||||||
let a = a.unwrap_err();
|
let a = a.unwrap_err();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
a.cause,
|
a.cause,
|
||||||
"The argument \'--develop\' cannot be used with \'--production\'"
|
"The argument \'--production\' cannot be used with \'--develop\'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ fn three_conflicting_arguments() {
|
||||||
let a = a.unwrap_err();
|
let a = a.unwrap_err();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
a.cause,
|
a.cause,
|
||||||
"The argument \'--one\' cannot be used with \'--two\'"
|
"The argument \'--two\' cannot be used with \'--one\'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue