mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
commit
f10375ebe0
4 changed files with 23 additions and 1 deletions
|
@ -16,6 +16,10 @@
|
||||||
* completions now continue completing even after first completion ([18fc2e5b](https://github.com/kbknapp/clap-rs/commit/18fc2e5b5af63bf54a94b72cec5e1223d49f4806))
|
* completions now continue completing even after first completion ([18fc2e5b](https://github.com/kbknapp/clap-rs/commit/18fc2e5b5af63bf54a94b72cec5e1223d49f4806))
|
||||||
* allows matching on possible values in options ([89cc2026](https://github.com/kbknapp/clap-rs/commit/89cc2026ba9ac69cf44c5254360bbf99236d4f89), closes [#557](https://github.com/kbknapp/clap-rs/issues/557))
|
* allows matching on possible values in options ([89cc2026](https://github.com/kbknapp/clap-rs/commit/89cc2026ba9ac69cf44c5254360bbf99236d4f89), closes [#557](https://github.com/kbknapp/clap-rs/issues/557))
|
||||||
|
|
||||||
|
#### Bug Fixes
|
||||||
|
|
||||||
|
* **AllowLeadingHyphen:** fixes an issue where isn't ignored like it should be with this setting ([96c24c9a](https://github.com/kbknapp/clap-rs/commit/96c24c9a8fa1f85e06138d3cdd133e51659e19d2), closes [#558](https://github.com/kbknapp/clap-rs/issues/558))
|
||||||
|
|
||||||
<a name="v2.8.0"></a>
|
<a name="v2.8.0"></a>
|
||||||
## v2.8.0 (2016-06-30)
|
## v2.8.0 (2016-06-30)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
||||||
Here's the highlights for v2.9.0
|
Here's the highlights for v2.9.0
|
||||||
|
|
||||||
* **Completions:** one can now [generate a bash completions](http://kbknapp.github.io/clap-rs/clap/struct.App.html#method.gen_completions) script at compile time! These completions work with options using [possible values](http://kbknapp.github.io/clap-rs/clap/struct.Arg.html#method.possible_values), [subcommand aliases](http://kbknapp.github.io/clap-rs/clap/struct.App.html#method.aliases), and even multiple levels of subcommands
|
* **Completions:** one can now [generate a bash completions](http://kbknapp.github.io/clap-rs/clap/struct.App.html#method.gen_completions) script at compile time! These completions work with options using [possible values](http://kbknapp.github.io/clap-rs/clap/struct.Arg.html#method.possible_values), [subcommand aliases](http://kbknapp.github.io/clap-rs/clap/struct.App.html#method.aliases), and even multiple levels of subcommands
|
||||||
|
* Minor bug fixes when using `AppSettings::TrailingVarArg` and `AppSettings::AllowLeadingHyphen`
|
||||||
|
|
||||||
Here's the highlights for v2.8.0
|
Here's the highlights for v2.8.0
|
||||||
|
|
||||||
|
|
|
@ -586,7 +586,9 @@ impl<'a, 'b> Parser<'a, 'b>
|
||||||
}
|
}
|
||||||
|
|
||||||
needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
|
needs_val_of = try!(self.parse_long_arg(matcher, &arg_os));
|
||||||
|
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
} else if arg_os.starts_with(b"-") && arg_os.len_() != 1 {
|
} else if arg_os.starts_with(b"-") && arg_os.len_() != 1 {
|
||||||
needs_val_of = try!(self.parse_short_arg(matcher, &arg_os));
|
needs_val_of = try!(self.parse_short_arg(matcher, &arg_os));
|
||||||
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
|
if !(needs_val_of.is_none() && self.is_set(AppSettings::AllowLeadingHyphen)) {
|
||||||
|
@ -1175,6 +1177,8 @@ impl<'a, 'b> Parser<'a, 'b>
|
||||||
// Handle conflicts, requirements, etc.
|
// Handle conflicts, requirements, etc.
|
||||||
arg_post_processing!(self, flag, matcher);
|
arg_post_processing!(self, flag, matcher);
|
||||||
|
|
||||||
|
return Ok(None);
|
||||||
|
} else if self.is_set(AppSettings::AllowLeadingHyphen) {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,3 +234,16 @@ fn delim_values_trailingvararg() {
|
||||||
assert!(m.is_present("opt"));
|
assert!(m.is_present("opt"));
|
||||||
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>(), &["test", "--foo", "-Wl", "-bar"]);
|
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>(), &["test", "--foo", "-Wl", "-bar"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn leading_double_hyphen_trailingvararg() {
|
||||||
|
let m = App::new("positional")
|
||||||
|
.setting(AppSettings::TrailingVarArg)
|
||||||
|
.setting(AppSettings::AllowLeadingHyphen)
|
||||||
|
.arg(
|
||||||
|
Arg::from_usage("[opt]... 'some pos'"),
|
||||||
|
)
|
||||||
|
.get_matches_from(vec!["", "--foo", "-Wl", "bar"]);
|
||||||
|
assert!(m.is_present("opt"));
|
||||||
|
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>(), &["--foo", "-Wl", "bar"]);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue