mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 07:12:32 +00:00
Merge pull request #1588 from lucab/ups/parser-quote-name-v3
app: quote field names in errors
This commit is contained in:
commit
c3eca6cdd7
1 changed files with 5 additions and 5 deletions
|
@ -1466,7 +1466,7 @@ impl<'b> App<'b> {
|
||||||
for name in self.args.args.iter().map(|x| x.id) {
|
for name in self.args.args.iter().map(|x| x.id) {
|
||||||
if self.args.args.iter().filter(|x| x.id == name).count() > 1 {
|
if self.args.args.iter().filter(|x| x.id == name).count() > 1 {
|
||||||
panic!(format!(
|
panic!(format!(
|
||||||
"Arg names must be unique, found {} more than once",
|
"Arg names must be unique, found '{}' more than once",
|
||||||
name
|
name
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1619,7 +1619,7 @@ impl<'b> App<'b> {
|
||||||
if let Some(l) = a.long {
|
if let Some(l) = a.long {
|
||||||
assert!(
|
assert!(
|
||||||
self.args.args.iter().filter(|x| x.long == Some(l)).count() < 2,
|
self.args.args.iter().filter(|x| x.long == Some(l)).count() < 2,
|
||||||
"Argument long must be unique\n\n\t--{} is already in use",
|
"Argument long must be unique\n\n\t'--{}' is already in use",
|
||||||
l
|
l
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1628,7 +1628,7 @@ impl<'b> App<'b> {
|
||||||
if let Some(s) = a.short {
|
if let Some(s) = a.short {
|
||||||
assert!(
|
assert!(
|
||||||
self.args.args.iter().filter(|x| x.short == Some(s)).count() < 2,
|
self.args.args.iter().filter(|x| x.short == Some(s)).count() < 2,
|
||||||
"Argument short must be unique\n\n\t-{} is already in use",
|
"Argument short must be unique\n\n\t'-{}' is already in use",
|
||||||
s
|
s
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1650,13 +1650,13 @@ impl<'b> App<'b> {
|
||||||
if a.is_set(ArgSettings::Last) {
|
if a.is_set(ArgSettings::Last) {
|
||||||
assert!(
|
assert!(
|
||||||
a.long.is_none(),
|
a.long.is_none(),
|
||||||
"Flags or Options may not have last(true) set. {} has both a long and \
|
"Flags or Options may not have last(true) set. '{}' has both a long and \
|
||||||
last(true) set.",
|
last(true) set.",
|
||||||
a.name
|
a.name
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
a.short.is_none(),
|
a.short.is_none(),
|
||||||
"Flags or Options may not have last(true) set. {} has both a short and \
|
"Flags or Options may not have last(true) set. '{}' has both a short and \
|
||||||
last(true) set.",
|
last(true) set.",
|
||||||
a.name
|
a.name
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue