mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
965dff64c2
7 changed files with 63 additions and 28 deletions
1
.github/ISSUE_TEMPLATE.md
vendored
1
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,6 +1,7 @@
|
|||
<!--
|
||||
Please use the following template to assist with creating an issue and to ensure a speedy resolution. If an area is not applicable, feel free to delete the area or mark with `N/A`
|
||||
-->
|
||||
|
||||
### Rust Version
|
||||
|
||||
* Use the output of `rustc -V`
|
||||
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,4 +1,15 @@
|
|||
<a name="v2.24.2"></a>
|
||||
<a name="v2.25.1"></a>
|
||||
### v2.25.1 (2017-07-21)
|
||||
|
||||
#### Improvements
|
||||
|
||||
* impl Default for Values + OsValues for any lifetime. ([fb7d6231f1](https://github.com/kbknapp/clap-rs/commit/fb7d6231f13a2f79f411e62dca210b7dc9994c18))
|
||||
|
||||
#### Documentation
|
||||
|
||||
* Various documentation typos and grammar fixes
|
||||
|
||||
<a name="v2.25.0"></a>
|
||||
### v2.25.0 (2017-06-20)
|
||||
|
||||
|
||||
|
@ -21,7 +32,6 @@
|
|||
* **Arg::allow_hyphen_values:** updates the docs to include warnings for allow_hyphen_values and multiple(true) used together ([f9b0d657](https://github.com/kbknapp/clap-rs/commit/f9b0d657835d3f517f313d70962177dc30acf4a7))
|
||||
* **README.md:**
|
||||
* added a warning about using ~ deps ([821929b5](https://github.com/kbknapp/clap-rs/commit/821929b51bd60213955705900a436c9a64fcb79f), closes [#964](https://github.com/kbknapp/clap-rs/issues/964))
|
||||
* added a warning about using ~ deps ([667697b0](https://github.com/kbknapp/clap-rs/commit/667697b0018369b71da41d02d567ab57df0f4887))
|
||||
* **clap_app!:** adds using the @group specifier to the macro docs ([826048cb](https://github.com/kbknapp/clap-rs/commit/826048cb3cbc0280169303f1498ff0a2b7395883), closes [#932](https://github.com/kbknapp/clap-rs/issues/932))
|
||||
|
||||
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
|
||||
name = "clap"
|
||||
version = "2.25.0"
|
||||
version = "2.25.1"
|
||||
authors = ["Kevin K. <kbknapp@gmail.com>"]
|
||||
exclude = ["examples/*", "clap-test/*", "tests/*", "benches/*", "*.png", "clap-perf/*", "*.dot"]
|
||||
repository = "https://github.com/kbknapp/clap-rs.git"
|
||||
|
@ -15,6 +15,10 @@ description = """
|
|||
A simple to use, efficient, and full featured Command Line Argument Parser
|
||||
"""
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "kbknapp/clap-rs" }
|
||||
appveyor = { repository = "kbknapp/clap-rs" }
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.9"
|
||||
vec_map = "0.8"
|
||||
|
@ -43,6 +47,7 @@ nightly = [] # for building with unstable Rust features (currently none)
|
|||
lints = ["clippy"] # Requires nightly Rust
|
||||
debug = [] # Enables debug messages
|
||||
no_cargo = [] # Enable if you're not using Cargo, disables Cargo-env-var-dependent macros
|
||||
doc = ["yaml"] # All the features which add to documentation
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
|
@ -82,3 +87,6 @@ rpath = false
|
|||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 4
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["doc"]
|
||||
|
|
37
README.md
37
README.md
|
@ -45,26 +45,27 @@ Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
|||
|
||||
## What's New
|
||||
|
||||
Here's the highlights for v2.25.0
|
||||
Here's the highlights for v2.25.1
|
||||
|
||||
* use textwrap crate for wrapping help texts
|
||||
* suggests to use flag after subcommand when applicable
|
||||
* impl Default for Values + OsValues for any lifetime. ([fb7d6231f1](https://github.com/kbknapp/clap-rs/commit/fb7d6231f13a2f79f411e62dca210b7dc9994c18))
|
||||
|
||||
Here's the highlights for v2.21.0 to v2.25.0
|
||||
|
||||
* use textwrap crate for wrapping help texts
|
||||
* suggests to use flag after subcommand when applicable
|
||||
* Bumps bitflags crate to v0.9
|
||||
|
||||
Here's the highlights for v2.21.0 to v2.24.2
|
||||
|
||||
* fixes a bug where args that allow values to start with a hyphen couldnt contain a double hyphen -- as a value
|
||||
* fixes a bug where positional argument help text is misaligned
|
||||
* **App::template docs:** adds details about the necessity to use AppSettings::UnifiedHelpMessage when using {unified} tags in the help template
|
||||
* **Arg::allow_hyphen_values docs:** updates the docs to include warnings for allow_hyphen_values and multiple(true) used together
|
||||
* **clap_app! docs:** adds using the @group specifier to the macro docs
|
||||
* adds a debug assertion to ensure all args added to groups actually exist
|
||||
* fixes a bug where args with last(true) and required(true) set were not being printed in the usage string
|
||||
* fixes a bug that was printing the arg name, instead of value name when Arg::last(true) was used
|
||||
* fixes a bug where flags were parsed as flags AND positional values when specific combinations of settings were used
|
||||
* **README.md:** fix some typos
|
||||
* **Arg:** add `default_value_os`
|
||||
* **arg_matches.rs:** Added a Default implementation for Values and OsValues iterators.
|
||||
* fixes a bug where args that allow values to start with a hyphen couldnt contain a double hyphen -- as a value
|
||||
* fixes a bug where positional argument help text is misaligned
|
||||
* **App::template docs:** adds details about the necessity to use AppSettings::UnifiedHelpMessage when using {unified} tags in the help template
|
||||
* **Arg::allow_hyphen_values docs:** updates the docs to include warnings for allow_hyphen_values and multiple(true) used together
|
||||
* **clap_app! docs:** adds using the @group specifier to the macro docs
|
||||
* adds a debug assertion to ensure all args added to groups actually exist
|
||||
* fixes a bug where args with last(true) and required(true) set were not being printed in the usage string
|
||||
* fixes a bug that was printing the arg name, instead of value name when Arg::last(true) was used
|
||||
* fixes a bug where flags were parsed as flags AND positional values when specific combinations of settings were used
|
||||
* **README.md:** fix some typos
|
||||
* **Arg:** add `default_value_os`
|
||||
* **arg_matches.rs:** Added a Default implementation for Values and OsValues iterators.
|
||||
* **PowerShell Completions:**
|
||||
* fixes a bug where powershells completions cant be used if no subcommands are defined
|
||||
* massively dedups subcommand names in the generate script to make smaller scripts that are still functionally equiv
|
||||
|
|
|
@ -12,7 +12,8 @@ fn main() {
|
|||
.short("p")
|
||||
.takes_value(true))
|
||||
.arg(Arg::with_name("slop")
|
||||
.multiple(true))
|
||||
.multiple(true)
|
||||
.last(true))
|
||||
.get_matches();
|
||||
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ impl<'a, 'b> App<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Sets a string of the version number to be displayed when displaying version or help
|
||||
/// information with `-V`.
|
||||
/// information with `-V`.
|
||||
///
|
||||
/// **NOTE:** If only `version` is provided, and not [`App::long_version`] but the user
|
||||
/// requests `--version` clap will still display the contents of `version` appropriately
|
||||
|
@ -537,8 +537,8 @@ impl<'a, 'b> App<'a, 'b> {
|
|||
/// * `{usage}` - Automatically generated or given usage string.
|
||||
/// * `{all-args}` - Help for all arguments (options, flags, positionals arguments,
|
||||
/// and subcommands) including titles.
|
||||
/// * `{unified}` - Unified help for options and flags. Note, you must *also* set
|
||||
/// [`AppSettings::UnifiedHelpMessage`] to fully merge both options and
|
||||
/// * `{unified}` - Unified help for options and flags. Note, you must *also* set
|
||||
/// [`AppSettings::UnifiedHelpMessage`] to fully merge both options and
|
||||
/// flags, otherwise the ordering is "best effort"
|
||||
/// * `{flags}` - Help for flags.
|
||||
/// * `{options}` - Help for options.
|
||||
|
@ -1164,7 +1164,7 @@ impl<'a, 'b> App<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Prints the full help message to [`io::stdout()`] using a [`BufWriter`] using the same
|
||||
/// method as if someone ran `-h` to request the help message
|
||||
/// method as if someone ran `--help` to request the help message
|
||||
///
|
||||
/// **NOTE:** clap has the ability to distinguish between "short" and "long" help messages
|
||||
/// depending on if the user ran [`-h` (short)] or [`--help` (long)]
|
||||
|
|
|
@ -568,7 +568,7 @@ impl<'a> DoubleEndedIterator for Values<'a> {
|
|||
impl<'a> ExactSizeIterator for Values<'a> {}
|
||||
|
||||
/// Creates an empty iterator.
|
||||
impl Default for Values<'static> {
|
||||
impl<'a> Default for Values<'a> {
|
||||
fn default() -> Self {
|
||||
static EMPTY: [OsString; 0] = [];
|
||||
// This is never called because the iterator is empty:
|
||||
|
@ -583,6 +583,13 @@ fn test_default_values() {
|
|||
assert_eq!(values.next(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_values_with_shorter_lifetime() {
|
||||
let matches = ArgMatches::new();
|
||||
let mut values = matches.values_of("").unwrap_or_default();
|
||||
assert_eq!(values.next(), None);
|
||||
}
|
||||
|
||||
/// An iterator for getting multiple values out of an argument via the [`ArgMatches::values_of_os`]
|
||||
/// method. Usage of this iterator allows values which contain invalid UTF-8 code points unlike
|
||||
/// [`Values`].
|
||||
|
@ -622,7 +629,7 @@ impl<'a> DoubleEndedIterator for OsValues<'a> {
|
|||
}
|
||||
|
||||
/// Creates an empty iterator.
|
||||
impl Default for OsValues<'static> {
|
||||
impl<'a> Default for OsValues<'a> {
|
||||
fn default() -> Self {
|
||||
static EMPTY: [OsString; 0] = [];
|
||||
// This is never called because the iterator is empty:
|
||||
|
@ -636,3 +643,10 @@ fn test_default_osvalues() {
|
|||
let mut values: OsValues = OsValues::default();
|
||||
assert_eq!(values.next(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_osvalues_with_shorter_lifetime() {
|
||||
let matches = ArgMatches::new();
|
||||
let mut values = matches.values_of_os("").unwrap_or_default();
|
||||
assert_eq!(values.next(), None);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue