diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 425cab1d169..725b36bd91f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -161,7 +161,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
- toolchain: "1.78" # STABLE
+ toolchain: "1.79" # STABLE
- uses: Swatinem/rust-cache@v2
- name: Check documentation
env:
@@ -176,7 +176,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
- toolchain: "1.78" # STABLE
+ toolchain: "1.79" # STABLE
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
@@ -190,7 +190,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
- toolchain: "1.78" # STABLE
+ toolchain: "1.79" # STABLE
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Lint (ultra-minimal)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 740980951db..c72649bab43 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
+## [4.5.7] - 2024-06-10
+
+### Fixes
+
+- Clean up error message when too few arguments for `num_args`
+
## [4.5.6] - 2024-06-06
## [4.5.5] - 2024-06-06
@@ -4575,7 +4581,8 @@ Minimum version of Rust is now v1.13.0 (Stable)
* **arg** allow lifetimes other than 'static in arguments ([9e8c1fb9](https://github.com/clap-rs/clap/commit/9e8c1fb9406f8448873ca58bab07fe905f1551e5))
-[Unreleased]: https://github.com/clap-rs/clap/compare/v4.5.6...HEAD
+[Unreleased]: https://github.com/clap-rs/clap/compare/v4.5.7...HEAD
+[4.5.7]: https://github.com/clap-rs/clap/compare/v4.5.6...v4.5.7
[4.5.6]: https://github.com/clap-rs/clap/compare/v4.5.5...v4.5.6
[4.5.5]: https://github.com/clap-rs/clap/compare/v4.5.4...v4.5.5
[4.5.4]: https://github.com/clap-rs/clap/compare/v4.5.3...v4.5.4
diff --git a/CITATION.cff b/CITATION.cff
index ea3b48f729a..5775e834836 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -3,8 +3,8 @@ cff-version: 1.2.0
message: Please cite this crate using these information.
# Version information.
-date-released: 2024-06-06
-version: 4.5.6
+date-released: 2024-06-10
+version: 4.5.7
# Project information.
abstract: A full featured, fast Command Line Argument Parser for Rust
diff --git a/Cargo.lock b/Cargo.lock
index bb208e5d73b..55f1b3c7424 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -402,9 +402,18 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
dependencies = [
- "automod",
"clap_builder 4.5.6",
+]
+
+[[package]]
+name = "clap"
+version = "4.5.7"
+dependencies = [
+ "automod",
+ "clap_builder 4.5.7",
"clap_derive",
"humantime",
"rustversion",
@@ -414,20 +423,11 @@ dependencies = [
"trycmd",
]
-[[package]]
-name = "clap"
-version = "4.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7"
-dependencies = [
- "clap_builder 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "clap_bench"
version = "0.0.0"
dependencies = [
- "clap 4.5.6",
+ "clap 4.5.7",
"divan",
"lazy_static",
]
@@ -435,39 +435,39 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
dependencies = [
"anstream",
"anstyle",
- "backtrace",
- "clap_lex 0.7.1",
- "color-print",
- "static_assertions",
+ "clap_lex 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim",
"terminal_size 0.3.0",
- "unic-emoji-char",
- "unicase",
- "unicode-width",
]
[[package]]
name = "clap_builder"
-version = "4.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df"
+version = "4.5.7"
dependencies = [
"anstream",
"anstyle",
- "clap_lex 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "backtrace",
+ "clap_lex 0.7.1",
+ "color-print",
+ "static_assertions",
"strsim",
"terminal_size 0.3.0",
+ "unic-emoji-char",
+ "unicase",
+ "unicode-width",
]
[[package]]
name = "clap_complete"
-version = "4.5.5"
+version = "4.5.6"
dependencies = [
"automod",
- "clap 4.5.6",
+ "clap 4.5.7",
"clap_lex 0.7.1",
"completest",
"completest-pty",
@@ -483,7 +483,7 @@ dependencies = [
name = "clap_complete_fig"
version = "4.5.1"
dependencies = [
- "clap 4.5.6",
+ "clap 4.5.7",
"clap_complete",
"snapbox",
]
@@ -492,7 +492,7 @@ dependencies = [
name = "clap_complete_nushell"
version = "4.5.2"
dependencies = [
- "clap 4.5.6",
+ "clap 4.5.7",
"clap_complete",
"completest",
"completest-nu",
@@ -527,7 +527,7 @@ name = "clap_mangen"
version = "0.2.21"
dependencies = [
"automod",
- "clap 4.5.6",
+ "clap 4.5.7",
"roff",
"snapbox",
]
@@ -840,7 +840,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0d567df2c9c2870a43f3f2bd65aaeb18dbce1c18f217c3e564b4fbaeb3ee56c"
dependencies = [
"cfg-if",
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"condtype",
"divan-macros",
"libc",
@@ -3605,7 +3605,7 @@ version = "0.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8e090cfcfa51cb224d247e05938d25718a7203c6f8c0f0de7b3b031d99dcea"
dependencies = [
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"filetime",
"indicatif",
"libc",
@@ -3621,7 +3621,7 @@ version = "0.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbf657c9e738d16ebc5c161a611ff25327c1fb599645afb2831062efb23c851"
dependencies = [
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"uucore",
]
@@ -3631,7 +3631,7 @@ version = "0.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "154531208d9ec160629bf9545a56ad9df38e964e547e0a17ee9d75aeec9831cb"
dependencies = [
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"rand",
"tempfile",
"uucore",
@@ -3643,7 +3643,7 @@ version = "0.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70589dc3b41f34cbfe1fb22b8f20fcac233fa4565409905f12dd06780b18374d"
dependencies = [
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"libc",
"uucore",
"windows-sys 0.48.0",
@@ -3655,7 +3655,7 @@ version = "0.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bea3522caab8af3fe1de1f27d9691e4ea159efe4d86d4e176306792163936a6"
dependencies = [
- "clap 4.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 4.5.6",
"dunce",
"glob",
"libc",
diff --git a/Cargo.toml b/Cargo.toml
index 482b0162886..f871ba40613 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -101,7 +101,7 @@ blocks_in_conditions = "allow"
[package]
name = "clap"
-version = "4.5.6"
+version = "4.5.7"
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
categories = ["command-line-interface"]
keywords = [
@@ -176,7 +176,7 @@ unstable-styles = ["clap_builder/unstable-styles"]
bench = false
[dependencies]
-clap_builder = { path = "./clap_builder", version = "=4.5.6", default-features = false }
+clap_builder = { path = "./clap_builder", version = "=4.5.7", default-features = false }
clap_derive = { path = "./clap_derive", version = "=4.5.5", optional = true }
[dev-dependencies]
diff --git a/clap_builder/Cargo.toml b/clap_builder/Cargo.toml
index b0ac0369823..c100816bdde 100644
--- a/clap_builder/Cargo.toml
+++ b/clap_builder/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "clap_builder"
-version = "4.5.6"
+version = "4.5.7"
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
categories = ["command-line-interface"]
keywords = [
diff --git a/clap_builder/README.md b/clap_builder/README.md
index 6fcc659af8d..bbe67eb1c24 100644
--- a/clap_builder/README.md
+++ b/clap_builder/README.md
@@ -1,4 +1,4 @@
-# clap_builder
+# `clap_builder`
Builder implementation for clap.
diff --git a/clap_builder/src/error/format.rs b/clap_builder/src/error/format.rs
index 601edde9bd1..0f8644f6adc 100644
--- a/clap_builder/src/error/format.rs
+++ b/clap_builder/src/error/format.rs
@@ -337,7 +337,7 @@ fn write_dynamic_context(
let were_provided = singular_or_plural(*actual_num_values as usize);
let _ = write!(
styled,
- "{}{min_values}{} more values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}",
+ "{}{min_values}{} values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}",
valid.render(),
valid.render_reset(),
literal.render(),
diff --git a/clap_builder/src/output/help_template.rs b/clap_builder/src/output/help_template.rs
index 69907b6ede4..f3a2b02ed33 100644
--- a/clap_builder/src/output/help_template.rs
+++ b/clap_builder/src/output/help_template.rs
@@ -6,7 +6,6 @@
// Std
use std::borrow::Cow;
use std::cmp;
-use std::usize;
// Internal
use crate::builder::PossibleValue;
diff --git a/clap_complete/CHANGELOG.md b/clap_complete/CHANGELOG.md
index e03f896353e..0bce78adf49 100644
--- a/clap_complete/CHANGELOG.md
+++ b/clap_complete/CHANGELOG.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
+## [4.5.6] - 2024-06-19
+
## [4.5.5] - 2024-06-07
### Fixes
@@ -252,7 +254,8 @@ MSRV changed to 1.64.0
## [3.0.1] - 2022-01-03
-[Unreleased]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.5...HEAD
+[Unreleased]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.6...HEAD
+[4.5.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.5...clap_complete-v4.5.6
[4.5.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.4...clap_complete-v4.5.5
[4.5.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.3...clap_complete-v4.5.4
[4.5.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.2...clap_complete-v4.5.3
diff --git a/clap_complete/Cargo.toml b/clap_complete/Cargo.toml
index f00cd7c0552..119e5008561 100644
--- a/clap_complete/Cargo.toml
+++ b/clap_complete/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "clap_complete"
-version = "4.5.5"
+version = "4.5.6"
description = "Generate shell completion scripts for your clap::Command"
categories = ["command-line-interface"]
keywords = [
diff --git a/clap_complete/README.md b/clap_complete/README.md
index eb000eb6baa..8e984194c4f 100644
--- a/clap_complete/README.md
+++ b/clap_complete/README.md
@@ -5,16 +5,16 @@
[![Crates.io](https://img.shields.io/crates/v/clap_complete?style=flat-square)](https://crates.io/crates/clap_complete)
[![Crates.io](https://img.shields.io/crates/d/clap_complete?style=flat-square)](https://crates.io/crates/clap_complete)
-[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.5/LICENSE-APACHE)
-[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.5/LICENSE-MIT)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.6/LICENSE-APACHE)
+[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.6/LICENSE-MIT)
Dual-licensed under [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT).
1. [About](#about)
2. [API Reference](https://docs.rs/clap_complete)
3. [Questions & Discussions](https://github.com/clap-rs/clap/discussions)
-4. [CONTRIBUTING](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.5/clap_complete/CONTRIBUTING.md)
-5. [Sponsors](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.5/README.md#sponsors)
+4. [CONTRIBUTING](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.6/clap_complete/CONTRIBUTING.md)
+5. [Sponsors](https://github.com/clap-rs/clap/blob/clap_complete-v4.5.6/README.md#sponsors)
## About
diff --git a/clap_complete/src/lib.rs b/clap_complete/src/lib.rs
index eb9b3123a32..40485cf678f 100644
--- a/clap_complete/src/lib.rs
+++ b/clap_complete/src/lib.rs
@@ -5,13 +5,6 @@
// See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files in this repository
// for more information.
-#![doc(html_logo_url = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png")]
-#![doc = include_str!("../README.md")]
-#![cfg_attr(docsrs, feature(doc_auto_cfg))]
-#![warn(missing_docs, trivial_casts, unused_allocation, trivial_numeric_casts)]
-#![forbid(unsafe_code)]
-#![allow(clippy::needless_doctest_main)]
-
//! ## Quick Start
//!
//! - For generating at compile-time, see [`generate_to`]
@@ -56,8 +49,12 @@
//! }
//! ```
+#![doc(html_logo_url = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png")]
+#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+#![forbid(unsafe_code)]
#![warn(missing_docs)]
+#![allow(clippy::needless_doctest_main)]
#![warn(clippy::print_stderr)]
#![warn(clippy::print_stdout)]
diff --git a/clap_derive/README.md b/clap_derive/README.md
index 1ca9ce6c93f..2e17b693070 100644
--- a/clap_derive/README.md
+++ b/clap_derive/README.md
@@ -1,4 +1,4 @@
-# clap_derive
+# `clap_derive`
Macro implementation for clap's derives.
diff --git a/clap_mangen/README.md b/clap_mangen/README.md
index fe9d374e9d9..fa0f4c3e2a8 100644
--- a/clap_mangen/README.md
+++ b/clap_mangen/README.md
@@ -1,5 +1,5 @@
-# clap_mangen
+# `clap_mangen`
> **Manpage generation for `clap`**
diff --git a/src/lib.rs b/src/lib.rs
index 97a19363ac3..80af3446f78 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@
//! - [Cookbook][_cookbook]
//! - [FAQ][_faq]
//! - [Discussions](https://github.com/clap-rs/clap/discussions)
-//! - [CHANGELOG](https://github.com/clap-rs/clap/blob/v4.5.6/CHANGELOG.md) (includes major version migration
+//! - [CHANGELOG](https://github.com/clap-rs/clap/blob/v4.5.7/CHANGELOG.md) (includes major version migration
//! guides)
//!
//! ## Aspirations
@@ -64,7 +64,7 @@
//! - [clap_complete](https://crates.io/crates/clap_complete) for shell completion support
//!
//! CLI Helpers
-//! - [cio](https://crates.io/crates/clio) for reading/writing to files specified as arguments
+//! - [clio](https://crates.io/crates/clio) for reading/writing to files specified as arguments
//! - [clap-verbosity-flag](https://crates.io/crates/clap-verbosity-flag)
//! - [clap-cargo](https://crates.io/crates/clap-cargo)
//! - [concolor-clap](https://crates.io/crates/concolor-clap)
diff --git a/tests/builder/multiple_values.rs b/tests/builder/multiple_values.rs
index 4f14ea0ff1f..725f89069dc 100644
--- a/tests/builder/multiple_values.rs
+++ b/tests/builder/multiple_values.rs
@@ -176,7 +176,17 @@ fn option_exact_less() {
.try_get_matches_from(vec!["", "-o", "val1", "-o", "val2"]);
assert!(m.is_err());
- assert_eq!(m.unwrap_err().kind(), ErrorKind::WrongNumberOfValues);
+ let err = m.unwrap_err();
+ assert_eq!(err.kind(), ErrorKind::WrongNumberOfValues);
+ #[cfg(feature = "error-context")]
+ assert_data_eq!(err.to_string(), str![[r#"
+error: 3 values required for '-o