Bug fixes

This commit is contained in:
Kevin K 2015-03-22 22:26:07 -04:00
parent 66dab46760
commit 46bcf02a2f
3 changed files with 6 additions and 6 deletions

View file

@ -1,3 +1,5 @@
# v0.4.12
* Minor bug fixes
# v0.4.11
* Bug fixes and cleaned up code organization (well started to...)
* Changed runtime representation of arguments to lower allocated memory

View file

@ -1,7 +1,7 @@
[package]
name = "clap"
version = "0.4.11"
version = "0.4.12"
authors = ["Kevin K. <kbknapp@gmail.com>"]
exclude = ["docs/*", "examples/*", "tests/*"]
description = "A Command Line Argument Parser written in Rust"

View file

@ -694,7 +694,7 @@ impl App {
}
}
for v in self.flags.values().filter(|&v| v.long.is_some()).filter(|&v| v.long.unwrap() == arg) {
if let Some(v) = self.flags.values().filter(|&v| v.long.is_some()).filter(|&v| v.long.unwrap() == arg).nth(0) {
// Ensure this flag isn't on the mutually excludes list
if self.blacklist.contains(v.name) {
self.report_error(format!("The argument --{} is mutually exclusive with one or more other arguments", arg),
@ -772,9 +772,7 @@ impl App {
// Check for matching short in options, and return the name
// (only ones with shorts, of course)
for v in self.opts.values().filter(|&v| v.short.is_some()) {
if v.short.unwrap() != arg_c { continue; }
if let Some(v) = self.opts.values().filter(|&v| v.short.is_some()).filter(|&v| v.short.unwrap() == arg_c).nth(0) {
// Ensure this option isn't on the master mutually excludes list
if self.blacklist.contains(v.name) {
self.report_error(format!("The argument --{} is mutually exclusive with one or more other arguments", arg),
@ -782,7 +780,7 @@ impl App {
}
if matches.opts.contains_key(v.name) && !v.multiple {
self.report_error(format!("Argument --{} was supplied more than once, but does not support multiple values", arg), true, true);
self.report_error(format!("Argument -{} was supplied more than once, but does not support multiple values", arg), true, true);
}
matches.opts.insert(v.name, OptArg{