This commit is contained in:
Kevin K 2015-02-27 16:58:13 -05:00
parent c1836f8d1d
commit a58b5d34b2

View file

@ -180,9 +180,10 @@ impl App {
println!(""); println!("");
println!("OPTIONS:"); println!("OPTIONS:");
for (_, v) in self.opts.iter() { for (_, v) in self.opts.iter() {
println!("{}{}\t\t{}", println!("{}{}{}\t\t{}",
if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")}, if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")},
if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" ")}, if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" ")},
format!(" <{}>", v.name),
if let Some(ref h) = v.help {*h} else {" "} ); if let Some(ref h) = v.help {*h} else {" "} );
} }
} }
@ -404,26 +405,26 @@ impl App {
for name in self.blacklist.iter() { for name in self.blacklist.iter() {
for (k, v) in matches.flags.iter() { for (k, v) in matches.flags.iter() {
if k == name { if k == name {
self.report_error(&format!("The argument \"{}\" is mutually exclusive with one or more other arguments", self.report_error(&format!("The argument {} is mutually exclusive with one or more other arguments",
if let Some(s) = v.short { if let Some(s) = v.short {
format!("-{}", s) format!("-{}", s)
} else if let Some(l) = v.long { } else if let Some(l) = v.long {
format!("--{}", l) format!("--{}", l)
} else { } else {
format!("{}", v.name) format!("\"{}\"", v.name)
}), }),
false, true); false, true);
} }
} }
for (k, v) in matches.opts.iter() { for (k, v) in matches.opts.iter() {
if k == name { if k == name {
self.report_error(&format!("The argument \"{}\" is mutually exclusive with one or more other arguments", self.report_error(&format!("The argument {} is mutually exclusive with one or more other arguments",
if let Some(s) = v.short { if let Some(s) = v.short {
format!("-{}", s) format!("-{}", s)
} else if let Some(l) = v.long { } else if let Some(l) = v.long {
format!("--{}", l) format!("--{}", l)
} else { } else {
format!("{}", v.name) format!("\"{}\"", v.name)
}), }),
false, true); false, true);
} }