From 6802ac4a59c142cda9ec55ca0c45ae5cb9a6ab55 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 29 Jan 2017 18:10:14 -0500 Subject: [PATCH 1/4] imp: updates libc and term_size deps for the libc version conflict --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index abad65b5114..e0bc4685477 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,10 @@ unicode-width = "0.1.4" unicode-segmentation = "1.0.1" strsim = { version = "0.6.0", optional = true } ansi_term = { version = "0.9.0", optional = true } -term_size = { version = "0.2.1", optional = true } -libc = { version = "0.2.18", optional = true } +term_size = { version = "0.2.2", optional = true } +libc = { version = "0.2.20", optional = true } yaml-rust = { version = "0.3.5", optional = true } -clippy = { version = "~0.0.104", optional = true } +clippy = { version = "~0.0.112", optional = true } [dev-dependencies] regex = "~0.1.80" From 69bd16c4106cffbb6ee5533039669bd559b42b77 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 29 Jan 2017 18:37:24 -0500 Subject: [PATCH 2/4] chore: clippy run --- src/app/help.rs | 28 ++++++++++++++-------------- src/app/parser.rs | 21 +++++++++++---------- src/app/settings.rs | 8 ++++---- src/args/arg.rs | 4 ++-- src/args/arg_builder/valued.rs | 2 +- src/macros.rs | 2 +- 6 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/app/help.rs b/src/app/help.rs index 1947d190bc1..56cabba33ab 100644 --- a/src/app/help.rs +++ b/src/app/help.rs @@ -204,7 +204,7 @@ impl<'a> Help<'a> { if first { first = false; } else { - try!(self.writer.write(b"\n")); + try!(self.writer.write_all(b"\n")); } try!(self.write_arg(arg.as_base())); } @@ -240,7 +240,7 @@ impl<'a> Help<'a> { if first { first = false; } else { - try!(self.writer.write(b"\n")); + try!(self.writer.write_all(b"\n")); } try!(self.write_arg(arg.as_base())); } @@ -562,7 +562,7 @@ impl<'a> Help<'a> { } if opts { if !first { - try!(self.writer.write(b"\n\n")); + try!(self.writer.write_all(b"\n\n")); } try!(color!(self, "OPTIONS:\n", warning)); try!(self.write_args(parser.opts().map(as_arg_trait))); @@ -572,7 +572,7 @@ impl<'a> Help<'a> { if pos { if !first { - try!(self.writer.write(b"\n\n")); + try!(self.writer.write_all(b"\n\n")); } try!(color!(self, "ARGS:\n", warning)); try!(self.write_args_unsorted(parser.positionals().map(as_arg_trait))); @@ -581,7 +581,7 @@ impl<'a> Help<'a> { if subcmds { if !first { - try!(self.writer.write(b"\n\n")); + try!(self.writer.write_all(b"\n\n")); } try!(color!(self, "SUBCOMMANDS:\n", warning)); try!(self.write_subcommands(&parser)); @@ -608,7 +608,7 @@ impl<'a> Help<'a> { if first { first = false; } else { - try!(self.writer.write(b"\n")); + try!(self.writer.write_all(b"\n")); } try!(self.write_arg(sc)); } @@ -653,7 +653,7 @@ impl<'a> Help<'a> { debugln!("Help::write_default_help;"); if let Some(h) = parser.meta.pre_help { try!(self.write_before_after_help(h)); - try!(self.writer.write(b"\n\n")); + try!(self.writer.write_all(b"\n\n")); } macro_rules! write_thing { @@ -667,9 +667,9 @@ impl<'a> Help<'a> { } // Print the version try!(self.write_bin_name(&parser)); - try!(self.writer.write(b" ")); + try!(self.writer.write_all(b" ")); try!(self.write_version(&parser)); - try!(self.writer.write(b"\n")); + try!(self.writer.write_all(b"\n")); if let Some(author) = parser.meta.author { write_thing!(author) } @@ -694,7 +694,7 @@ impl<'a> Help<'a> { if let Some(h) = parser.meta.more_help { if flags || opts || pos || subcmds { - try!(self.writer.write(b"\n\n")); + try!(self.writer.write_all(b"\n\n")); } try!(self.write_before_after_help(h)); } @@ -857,7 +857,7 @@ impl<'a> Help<'a> { }); match &tag_buf.get_ref()[0..tag_length] { b"?" => { - try!(self.writer.write(b"Could not decode tag name")); + try!(self.writer.write_all(b"Could not decode tag name")); } b"bin" => { try!(self.write_bin_name(&parser)); @@ -916,9 +916,9 @@ impl<'a> Help<'a> { } // Unknown tag, write it back. r => { - try!(self.writer.write(b"{")); - try!(self.writer.write(r)); - try!(self.writer.write(b"}")); + try!(self.writer.write_all(b"{")); + try!(self.writer.write_all(r)); + try!(self.writer.write_all(b"}")); } } } diff --git a/src/app/parser.rs b/src/app/parser.rs index c14d7a7ba0d..2c2dcb733bf 100644 --- a/src/app/parser.rs +++ b/src/app/parser.rs @@ -455,8 +455,7 @@ impl<'a, 'b> Parser<'a, 'b> } else if count == 1 { let p = self.positionals .values() - .filter(|p| !p.is_set(ArgSettings::Required)) - .next() + .find(|p| !p.is_set(ArgSettings::Required)) .expect(INTERNAL_ERROR_MSG); return Some(format!(" [{}]{}", p.name_no_brackets(), p.multiple_str())); } else if self.is_set(AppSettings::DontCollapseArgsInUsage) && @@ -550,7 +549,7 @@ impl<'a, 'b> Parser<'a, 'b> debug_assert!({ let mut it = self.positionals.values().rev(); // Either the final positional is required - it.next().unwrap().is_set(ArgSettings::Required) + it.next().unwrap().is_set(ArgSettings::Required) // Or the second to last has a terminator set || it.next().unwrap().v.terminator.is_some() }, @@ -723,6 +722,8 @@ impl<'a, 'b> Parser<'a, 'b> sc._help() } + // allow wrong self convention due to self.valid_neg_num = true and it's a private method + #[cfg_attr(feature = "lints", allow(wrong_self_convention))] #[inline] fn is_new_arg(&mut self, arg_os: &OsStr, needs_val_of: Option<&'a str>) -> bool { debugln!("Parser::is_new_arg: arg={:?}, Needs Val of={:?}", arg_os, needs_val_of); @@ -776,7 +777,7 @@ impl<'a, 'b> Parser<'a, 'b> } // The actual parsing function - #[cfg_attr(feature = "lints", allow(while_let_on_iterator))] + #[cfg_attr(feature = "lints", allow(while_let_on_iterator, collapsible_if))] pub fn get_matches_with(&mut self, matcher: &mut ArgMatcher<'a>, it: &mut Peekable) @@ -812,8 +813,8 @@ impl<'a, 'b> Parser<'a, 'b> } subcmd_name = Some(arg_os.to_str().expect(INVALID_UTF8).to_owned()); break; - } - + } + if !starts_new_arg { if let Some(name) = needs_val_of { // Check to see if parsing a value from a previous arg @@ -859,8 +860,8 @@ impl<'a, 'b> Parser<'a, 'b> continue; } } - } - + } + if !self.is_set(AppSettings::ArgsNegateSubcommands) { if let Some(cdate) = suggestions::did_you_mean(&*arg_os.to_string_lossy(), @@ -1954,7 +1955,7 @@ impl<'a, 'b> Parser<'a, 'b> usage.push_str(&*self.meta .usage .as_ref() - .unwrap_or(self.meta + .unwrap_or_else(|| self.meta .bin_name .as_ref() .unwrap_or(&self.meta.name))); @@ -2022,7 +2023,7 @@ impl<'a, 'b> Parser<'a, 'b> usage.push_str(&self.meta .usage .as_ref() - .unwrap_or(self.meta + .unwrap_or_else(|| self.meta .bin_name .as_ref() .unwrap_or(&self.meta diff --git a/src/app/settings.rs b/src/app/settings.rs index 592e7dcaef4..37cdce9f600 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -43,12 +43,12 @@ bitflags! { } #[doc(hidden)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct AppFlags(Flags); -impl Clone for AppFlags { - fn clone(&self) -> Self { AppFlags(self.0) } -} +// impl Clone for AppFlags { +// fn clone(&self) -> Self { AppFlags(self.0) } +// } impl BitOr for AppFlags { type Output = Self; diff --git a/src/args/arg.rs b/src/args/arg.rs index 5a8122b8d51..8bd198536f9 100644 --- a/src/args/arg.rs +++ b/src/args/arg.rs @@ -3208,7 +3208,7 @@ impl<'a, 'b, 'z> From<&'z Arg<'a, 'b>> for Arg<'a, 'b> { disp_ord: a.disp_ord, r_unless: a.r_unless.clone(), r_ifs: a.r_ifs.clone(), - val_terminator: a.val_terminator.clone(), + val_terminator: a.val_terminator, } } } @@ -3240,7 +3240,7 @@ impl<'a, 'b> Clone for Arg<'a, 'b> { disp_ord: self.disp_ord, r_unless: self.r_unless.clone(), r_ifs: self.r_ifs.clone(), - val_terminator: self.val_terminator.clone(), + val_terminator: self.val_terminator, } } } diff --git a/src/args/arg_builder/valued.rs b/src/args/arg_builder/valued.rs index 7b69ea4d125..503b0d5947d 100644 --- a/src/args/arg_builder/valued.rs +++ b/src/args/arg_builder/valued.rs @@ -54,7 +54,7 @@ impl<'n, 'e, 'z> From<&'z Arg<'n, 'e>> for Valued<'n, 'e> { val_delim: a.val_delim, default_val: a.default_val, default_vals_ifs: a.default_vals_ifs.clone(), - terminator: a.val_terminator.clone(), + terminator: a.val_terminator, }; if let Some(ref vec) = a.val_names { if vec.len() > 1 { diff --git a/src/macros.rs b/src/macros.rs index 2eb79efd78f..86a2c8eb063 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -754,7 +754,7 @@ macro_rules! write_nspaces { ($dst:expr, $num:expr) => ({ debugln!("write_spaces!: num={}", $num); for _ in 0..$num { - try!($dst.write(b" ")); + try!($dst.write_all(b" ")); } }) } From e112cdd7de68974d66c542a5bfd08be59f9bc40b Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 29 Jan 2017 18:38:55 -0500 Subject: [PATCH 3/4] chore: updates pinned rustc nightly --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86f912cd319..6e74a6ae33b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: rust cache: cargo rust: - nightly - - nightly-2016-12-29 + - nightly-2017-01-25 - beta - stable - 1.11.0 From 8e2e7448e9d6080ed912b6e252b540f55002e0bd Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sun, 29 Jan 2017 18:52:04 -0500 Subject: [PATCH 4/4] chore: increase version --- CHANGELOG.md | 16 ++++++++++++++++ Cargo.toml | 2 +- README.md | 13 +++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b2d59618d..08b782fddd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ + +### v2.20.1 (2017-01-30) + +#### Bug Fixes + +* Fix finding required arguments in group arguments ([f9f778e](https://github.com/kbknapp/clap-rs/commit/5b29be9b073330ab1f7227cdd19fe4aab39d5dcb), closes [#829](https://github.com/kbknapp/clap-rs/pull/829)) + +#### Documentation + +* fix link from app_from_crate! to crate_authors! ([5b29be9b](https://github.com/kbknapp/clap-rs/commit/5b29be9b073330ab1f7227cdd19fe4aab39d5dcb), closes [#822](https://github.com/kbknapp/clap-rs/pull/822)) +* fix spelling of "guaranteed" ([4f30a65b](https://github.com/kbknapp/clap-rs/commit/4f30a65b9c03eb09607eb91a929a6396637dc105)) + +#### Improvements + +* updates libc and term_size deps for the libc version conflict ([6802ac4a](https://github.com/kbknapp/clap-rs/commit/6802ac4a59c142cda9ec55ca0c45ae5cb9a6ab55)) + #### New Settings diff --git a/Cargo.toml b/Cargo.toml index e0bc4685477..bce15373793 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clap" -version = "2.20.0" +version = "2.20.1" authors = ["Kevin K. "] exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"] repository = "https://github.com/kbknapp/clap-rs.git" diff --git a/README.md b/README.md index 9cd670f1b0f..9c31af61f82 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,15 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc) ## What's New -Here's the highlights for v2.20.0 +Here's the highlights for v2.20.1 + +* updates libc and term_size deps for the libc version conflict +* Fix finding required arguments in group arguments +* fix link from app_from_crate! to crate_authors! +* fix spelling of "guaranteed" + + +Here's the highlights from v2.0.0 to v2.20.0 * **ArgsNegateSubcommands:** disables args being allowed between subcommands * **DontCollapseArgsInUsage:** disables the collapsing of positional args into `[ARGS]` in the usage string @@ -72,9 +80,6 @@ Here's the highlights for v2.20.0 * **Help Wrapping:** long app names (with spaces), authors, and descriptions are now wrapped appropriately * **Conditional Default Values:** fixes the failing doc tests of Arg::default_value_ifs * **Conditional Requirements:** adds docs for Arg::requires_ifs - -Here's the highlights from v2.0.0 to v2.19.3 - * Fixes a bug where calling the help of a subcommand wasn't ignoring required args of parent commands * Fixes a bug by escaping square brackets in ZSH completions which were causing conflicts and errors. * **Bash Completion:** allows bash completion to fall back to traidtional bash completion upon no matching completing function