diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/clap_builder | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap_builder')
-rw-r--r-- | vendor/clap_builder/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/clap_builder/Cargo.toml | 23 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/arg.rs | 2 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/command.rs | 60 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/debug_asserts.rs | 3 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/mod.rs | 8 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/range.rs | 2 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/styled_str.rs | 15 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/styling.rs | 2 | ||||
-rw-r--r-- | vendor/clap_builder/src/builder/value_parser.rs | 190 | ||||
-rw-r--r-- | vendor/clap_builder/src/derive.rs | 2 | ||||
-rw-r--r-- | vendor/clap_builder/src/error/mod.rs | 4 | ||||
-rw-r--r-- | vendor/clap_builder/src/lib.rs | 7 | ||||
-rw-r--r-- | vendor/clap_builder/src/macros.rs | 6 | ||||
-rw-r--r-- | vendor/clap_builder/src/mkeymap.rs | 9 | ||||
-rw-r--r-- | vendor/clap_builder/src/output/help.rs | 6 | ||||
-rw-r--r-- | vendor/clap_builder/src/parser/matches/arg_matches.rs | 12 | ||||
-rw-r--r-- | vendor/clap_builder/src/parser/parser.rs | 83 |
18 files changed, 346 insertions, 90 deletions
diff --git a/vendor/clap_builder/.cargo-checksum.json b/vendor/clap_builder/.cargo-checksum.json index 6767a5bd9..f107a15d3 100644 --- a/vendor/clap_builder/.cargo-checksum.json +++ b/vendor/clap_builder/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"09f09455758e977503cd682e65252b3c428fb60e5f9d6b8fe09060b5ad9d9d32","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"60b99346464866941b21928d3c4699fd6a3ca85a541da7577f60bc691b7afef8","src/builder/action.rs":"9b920d2d405825ce89a5ba3b59edc66e3b849841819e9742b19010a81584fee7","src/builder/app_settings.rs":"286f925717fa54fe9d2ed6f2f338293b7a5981fee0fe687fe706118cebf1f6f4","src/builder/arg.rs":"cfe91d01f953dcc1b0e103e88f4425a34f64e8c1261f6fc38ef666a5577b99b5","src/builder/arg_group.rs":"82a6e9afeea1792a4ca99baa3b0d3235eb012b037cc19333ed9b03a13bb66f30","src/builder/arg_predicate.rs":"4fe55fdd0441acb1577f28188c86f920df4863f451a7dcad8e050dbb6e1e7516","src/builder/arg_settings.rs":"e8ad1bd6d36da43d7329b6cd86833d4cc63734e64119c6b950a45ded5e3aec9c","src/builder/command.rs":"c366814ca5869e0a6784696d776cc4bbcf05b75ee5559f3f778bb6d085e18298","src/builder/debug_asserts.rs":"8422c3be1c6565c09683e0225ee54a9e2e5cdd21c91376822e46abdb68deb10a","src/builder/ext.rs":"736cfb56f765cbe23301ebcad83fbe3edfc778954edc4747ccf7c23104d85638","src/builder/mod.rs":"c9cd69cd3d1248a82d7790f97932bea0f2ff21acfc7980833939a0f97aa0073d","src/builder/os_str.rs":"2b635e4fa8ecc42ad1d964a8b2f0fe17aa57d976c163d3bf77f213de254d844f","src/builder/possible_value.rs":"2ed44c5a353c0abab337ac0f00995066f96ff27c33098613642725991163edff","src/builder/range.rs":"bdaa3da849b74dc42a6b6ace87870329d34632e93fa9905a45b2fe86f549220a","src/builder/resettable.rs":"c4cd481051ec361529817ebae73b4dd307b0a4a3b88a3ddcecb8dd45b05db431","src/builder/str.rs":"e51a1e5c18364c9132d1c7df113e6a462265e40f767087fa9664bfcd5f5d91b4","src/builder/styled_str.rs":"df58c3a2bdfdcb0a11da5eb1ef6ed411d68c455a4df9a37a458663c21b0cbeb9","src/builder/styling.rs":"4ea1552731976a824d61b7880f21859a6030b2a1037e76dda8e74d009eb571f6","src/builder/tests.rs":"565f5efd38c6596e55fa1c077a11cc07be94ca201527963d27fd42ddce6dbbe8","src/builder/value_hint.rs":"66588792cddf7e3bb2912da4e0a53584169c266f9e4e6dcb990295998d158f93","src/builder/value_parser.rs":"03020c9b2da9c7129196338a3de1336932eeb54ddc08bfcef9cd198eb56603e3","src/derive.rs":"201404c128c92ce59d6c88931ba789e389508334852b758ae620aa3e2ccf930c","src/error/context.rs":"156d2611a349ce826378476c9dcb3242a01ad834a095baad096a10cc2f73e1ed","src/error/format.rs":"33903b182f9b8fde0a2ad2f5f96582ed3812d37c51a03f2c775553db8351e5e8","src/error/kind.rs":"29603c64b8cea7886498afc3f7e7c489505c9820c5159e99d153d57fdafe95ec","src/error/mod.rs":"f5a6f3ba9273421cff91bd0a0998549a5b886b5832129f02830fbb1cc95b176e","src/lib.rs":"9295447fadf8a95dfcffa93bf5824c5235d8b3449cd5d1463d88b291f40972f6","src/macros.rs":"fc190536cd2b39cfe6b55a351df3f8402e81c6a6966208d1fdb36c4b48dbc72f","src/mkeymap.rs":"473eb25f9bf0017ade3a93e4cf6d27da4e3f5b4b64767a090cadbb56b9483957","src/output/fmt.rs":"17d7c95bae851fd0ffb7d3ea4c3c1830963c8b863aa8e4e296e3d824a1da18dc","src/output/help.rs":"1eea985c582395431ae5a8de6c1fcc4ca76317f61144ef46c6d530fda330ea7a","src/output/help_template.rs":"19e725674a92ef2a529e7583c0c139d04a420617be5e91e65341a2063b3d8a68","src/output/mod.rs":"74ea52be8981c30d10fda3f6c80cf51aafb15700de99aa73bc94700bca25ae11","src/output/textwrap/core.rs":"0d45b1ebe8bba3e54e8bcbfec015be626d55803a0a46aef753eb3a4be3cabab4","src/output/textwrap/mod.rs":"1bc5056701b6651a98b0eea482db5235ba3342a24a02d776ad364fec6919cecc","src/output/textwrap/word_separators.rs":"ae3af310295e707ae1aa95633f6bb078cedf8f65662a86caa9d25420f459acc1","src/output/textwrap/wrap_algorithms.rs":"a6eb1491ef5e64dbd2ef55d367e46747fcf2fb22fdb66a2b7c3cb9ba3a02d86a","src/output/usage.rs":"45dcf5520f0625da75f1ceb1d749aaeb13db882f64025ea89d039a2acfd72898","src/parser/arg_matcher.rs":"b6f17cfc48d18d192d6f4f45b9daf342b93d847ce7d52a3f68266c15566c3849","src/parser/error.rs":"7def6f001ad6dfd262d71149c6e4f3845a6f7bf246a92edc6d872e3ca4e2ae01","src/parser/features/mod.rs":"6ed075e97af56bff22f22ed1ee83ff6479360e05f9d3661a3145f822c242b694","src/parser/features/suggestions.rs":"832b62f927f9f4ffb95abdcef09c8b675045aab0b5471bae484e5d07f18f7621","src/parser/matches/arg_matches.rs":"8386f3d69141678074751ee26c8d7888fe320d07cc1fb6034341adb99f4eee13","src/parser/matches/matched_arg.rs":"8533197ac8f1a1a218844c34923beabd0ed0d28447b03bd9d4d199cc7ff251d0","src/parser/matches/mod.rs":"5578335f4b9103cc4060546621e5664d5e92c43848ec48c2d95a4b045373de1f","src/parser/matches/value_source.rs":"ecb9e09db06579489daa9cbcf351381041dff7c5e2956fb96052b70b9360955b","src/parser/mod.rs":"34d689dac5d878790e5c29872f59ccec000ceab737ddaa642054cb464e26edb8","src/parser/parser.rs":"1e7e6adac83f3a4621880e0104589481dfbad56d62106fcc23a49edb3dcbfe9a","src/parser/validator.rs":"107c4eaa1615c0414553862f0250e9bf4241cccb7d7ec6df4ac8784f5f850d11","src/util/any_value.rs":"f3666cf322e87daf83f1474d5449e9b526b80b835f032e4090c5e1abddf6f044","src/util/color.rs":"04cc72927ad1e7f5490e1db39b7f79b16ed613b7b81cfe0285b38ba9d0afb875","src/util/flat_map.rs":"89e6471d099485f943ed7331626db6fddd75598f2c98623a13f262ff1a08b509","src/util/flat_set.rs":"334f3b8a72a897fbabd68f2330a8ecc18af74492036822b2e3764d461ddf31b4","src/util/graph.rs":"f35396b6e2a427377dcbbca69b1b98737d89684a3834cfda98cbf8cc70ff9c2f","src/util/id.rs":"5f025a05e4752ef7d610d6490f4a83ab489b1e5038c1a15067c0be51caafde87","src/util/mod.rs":"010f54d58906f4ae0106f2f1a891ea80a55fd52c64b8946a6b59e20f9c502418","src/util/str_to_bool.rs":"1ce90b4939a884eeefc73392722bdfcf906e3070c4398e1557c586c10c684cd0"},"package":"01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1"}
\ No newline at end of file +{"files":{"Cargo.toml":"9fbd8b138d9dc414f6637500bb6cd733ff509394498499aef6aaa89411a13c27","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"60b99346464866941b21928d3c4699fd6a3ca85a541da7577f60bc691b7afef8","src/builder/action.rs":"9b920d2d405825ce89a5ba3b59edc66e3b849841819e9742b19010a81584fee7","src/builder/app_settings.rs":"286f925717fa54fe9d2ed6f2f338293b7a5981fee0fe687fe706118cebf1f6f4","src/builder/arg.rs":"032d895f056c29e5bef013b5eedcce396e4770a39a7f628fb29480e2a97e9220","src/builder/arg_group.rs":"82a6e9afeea1792a4ca99baa3b0d3235eb012b037cc19333ed9b03a13bb66f30","src/builder/arg_predicate.rs":"4fe55fdd0441acb1577f28188c86f920df4863f451a7dcad8e050dbb6e1e7516","src/builder/arg_settings.rs":"e8ad1bd6d36da43d7329b6cd86833d4cc63734e64119c6b950a45ded5e3aec9c","src/builder/command.rs":"c66c2e2b3ce9e6dfcf46ce12853d96fde671c4bf3275478d97c65adfd5909e4d","src/builder/debug_asserts.rs":"8c51bed316deceb349f900c83233866388eceb8d6ad6641e60bf2cb17738a808","src/builder/ext.rs":"736cfb56f765cbe23301ebcad83fbe3edfc778954edc4747ccf7c23104d85638","src/builder/mod.rs":"478946dd41eb4adcfd7a3e6159ad1474993fa89e9f1ec62aaf05c213d33be9d7","src/builder/os_str.rs":"2b635e4fa8ecc42ad1d964a8b2f0fe17aa57d976c163d3bf77f213de254d844f","src/builder/possible_value.rs":"2ed44c5a353c0abab337ac0f00995066f96ff27c33098613642725991163edff","src/builder/range.rs":"63583801f2f9daa43906bda84eb3a2ba9d6b5157745180acbc0a3284babe2d94","src/builder/resettable.rs":"c4cd481051ec361529817ebae73b4dd307b0a4a3b88a3ddcecb8dd45b05db431","src/builder/str.rs":"e51a1e5c18364c9132d1c7df113e6a462265e40f767087fa9664bfcd5f5d91b4","src/builder/styled_str.rs":"9a605e1fe93f602809645447b4560ad767292eac9a17614c8cdca697d813425e","src/builder/styling.rs":"3aac44f140d5247d27f661e328a05eae0bd8c6685c8bfc88ec703d3a21a47f50","src/builder/tests.rs":"565f5efd38c6596e55fa1c077a11cc07be94ca201527963d27fd42ddce6dbbe8","src/builder/value_hint.rs":"66588792cddf7e3bb2912da4e0a53584169c266f9e4e6dcb990295998d158f93","src/builder/value_parser.rs":"915fb8d50910711d5b704fab4c8fbcb3f1e0e2e66fef722e5806513618864477","src/derive.rs":"7e9e33ecb4c834ff1b6bcffd24358b3e2cfc946a5dc69f5ca8088f7ac4f145ce","src/error/context.rs":"156d2611a349ce826378476c9dcb3242a01ad834a095baad096a10cc2f73e1ed","src/error/format.rs":"33903b182f9b8fde0a2ad2f5f96582ed3812d37c51a03f2c775553db8351e5e8","src/error/kind.rs":"29603c64b8cea7886498afc3f7e7c489505c9820c5159e99d153d57fdafe95ec","src/error/mod.rs":"2ebe49387552c56e1b632fe647e45cbb71d590366785972758aecd04f88f9b90","src/lib.rs":"8b08b2d74ffc9c383f861ec94e41d02ea7c035081f44acd37079baeb1888e5a8","src/macros.rs":"f2c7145b2b10d36a7c2e0cc02502115be4162d2256e12328222121f4eefeb2b5","src/mkeymap.rs":"a644643a54ab1a6e353af4c746efc2c2e9e161e64fe3f3635c644748e02690d8","src/output/fmt.rs":"17d7c95bae851fd0ffb7d3ea4c3c1830963c8b863aa8e4e296e3d824a1da18dc","src/output/help.rs":"b3bb6cfffe9c1113d377f1f4951a22b6ad2ba2813dcc55a146899c808cd393d3","src/output/help_template.rs":"19e725674a92ef2a529e7583c0c139d04a420617be5e91e65341a2063b3d8a68","src/output/mod.rs":"74ea52be8981c30d10fda3f6c80cf51aafb15700de99aa73bc94700bca25ae11","src/output/textwrap/core.rs":"0d45b1ebe8bba3e54e8bcbfec015be626d55803a0a46aef753eb3a4be3cabab4","src/output/textwrap/mod.rs":"1bc5056701b6651a98b0eea482db5235ba3342a24a02d776ad364fec6919cecc","src/output/textwrap/word_separators.rs":"ae3af310295e707ae1aa95633f6bb078cedf8f65662a86caa9d25420f459acc1","src/output/textwrap/wrap_algorithms.rs":"a6eb1491ef5e64dbd2ef55d367e46747fcf2fb22fdb66a2b7c3cb9ba3a02d86a","src/output/usage.rs":"45dcf5520f0625da75f1ceb1d749aaeb13db882f64025ea89d039a2acfd72898","src/parser/arg_matcher.rs":"b6f17cfc48d18d192d6f4f45b9daf342b93d847ce7d52a3f68266c15566c3849","src/parser/error.rs":"7def6f001ad6dfd262d71149c6e4f3845a6f7bf246a92edc6d872e3ca4e2ae01","src/parser/features/mod.rs":"6ed075e97af56bff22f22ed1ee83ff6479360e05f9d3661a3145f822c242b694","src/parser/features/suggestions.rs":"832b62f927f9f4ffb95abdcef09c8b675045aab0b5471bae484e5d07f18f7621","src/parser/matches/arg_matches.rs":"902f512272d9c4a0c8be7ff3e5122b088ee6fde1694a7b4cfba88f941b361a3b","src/parser/matches/matched_arg.rs":"8533197ac8f1a1a218844c34923beabd0ed0d28447b03bd9d4d199cc7ff251d0","src/parser/matches/mod.rs":"5578335f4b9103cc4060546621e5664d5e92c43848ec48c2d95a4b045373de1f","src/parser/matches/value_source.rs":"ecb9e09db06579489daa9cbcf351381041dff7c5e2956fb96052b70b9360955b","src/parser/mod.rs":"34d689dac5d878790e5c29872f59ccec000ceab737ddaa642054cb464e26edb8","src/parser/parser.rs":"2c7951e94952ce86005115cd3b3d68bf36b9001cbbcbef360843294bb016cd2b","src/parser/validator.rs":"107c4eaa1615c0414553862f0250e9bf4241cccb7d7ec6df4ac8784f5f850d11","src/util/any_value.rs":"f3666cf322e87daf83f1474d5449e9b526b80b835f032e4090c5e1abddf6f044","src/util/color.rs":"04cc72927ad1e7f5490e1db39b7f79b16ed613b7b81cfe0285b38ba9d0afb875","src/util/flat_map.rs":"89e6471d099485f943ed7331626db6fddd75598f2c98623a13f262ff1a08b509","src/util/flat_set.rs":"334f3b8a72a897fbabd68f2330a8ecc18af74492036822b2e3764d461ddf31b4","src/util/graph.rs":"f35396b6e2a427377dcbbca69b1b98737d89684a3834cfda98cbf8cc70ff9c2f","src/util/id.rs":"5f025a05e4752ef7d610d6490f4a83ab489b1e5038c1a15067c0be51caafde87","src/util/mod.rs":"010f54d58906f4ae0106f2f1a891ea80a55fd52c64b8946a6b59e20f9c502418","src/util/str_to_bool.rs":"1ce90b4939a884eeefc73392722bdfcf906e3070c4398e1557c586c10c684cd0"},"package":"0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45"}
\ No newline at end of file diff --git a/vendor/clap_builder/Cargo.toml b/vendor/clap_builder/Cargo.toml index 30457b0ce..e02965142 100644 --- a/vendor/clap_builder/Cargo.toml +++ b/vendor/clap_builder/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.64.0" +rust-version = "1.70.0" name = "clap_builder" -version = "4.3.19" +version = "4.4.6" include = [ "build.rs", "src/**/*", @@ -59,7 +59,7 @@ tag-name = "v{{version}}" bench = false [dependencies.anstream] -version = "0.3.0" +version = "0.6.0" optional = true [dependencies.anstyle] @@ -72,16 +72,12 @@ optional = true [dependencies.clap_lex] version = "0.5.0" -[dependencies.once_cell] -version = "1.12.0" -optional = true - [dependencies.strsim] version = "0.10.0" optional = true [dependencies.terminal_size] -version = "0.2.1" +version = "0.3.0" optional = true [dependencies.unicase] @@ -99,22 +95,22 @@ version = "0.3.4" version = "2.1.0" [dev-dependencies.rustversion] -version = "1.0.12" +version = "1.0.14" [dev-dependencies.shlex] version = "1.1.0" [dev-dependencies.snapbox] -version = "0.4.11" +version = "0.4.13" [dev-dependencies.static_assertions] version = "1.1.0" [dev-dependencies.trybuild] -version = "1.0.80" +version = "1.0.83" [dev-dependencies.trycmd] -version = "0.14.16" +version = "0.14.18" features = [ "color-auto", "diff", @@ -126,7 +122,7 @@ default-features = false version = "0.9.0" [features] -cargo = ["dep:once_cell"] +cargo = [] color = ["dep:anstream"] debug = ["dep:backtrace"] default = [ @@ -157,7 +153,6 @@ unstable-doc = [ "env", "unicode", "string", - "unstable-styles", ] unstable-styles = ["color"] unstable-v5 = ["deprecated"] diff --git a/vendor/clap_builder/src/builder/arg.rs b/vendor/clap_builder/src/builder/arg.rs index d067dec1d..5634078c5 100644 --- a/vendor/clap_builder/src/builder/arg.rs +++ b/vendor/clap_builder/src/builder/arg.rs @@ -470,7 +470,7 @@ impl Arg { /// /// [`Command`] will [`panic!`] if indexes are skipped (such as defining `index(1)` and `index(3)` /// but not `index(2)`, or a positional argument is defined as multiple and is not the highest - /// index + /// index (debug builds) /// /// # Examples /// diff --git a/vendor/clap_builder/src/builder/command.rs b/vendor/clap_builder/src/builder/command.rs index b2efdbc7e..b1623cf8c 100644 --- a/vendor/clap_builder/src/builder/command.rs +++ b/vendor/clap_builder/src/builder/command.rs @@ -252,6 +252,52 @@ impl Command { self } + /// Allows one to mutate all [`Arg`]s after they've been added to a [`Command`]. + /// + /// This does not affect the built-in `--help` or `--version` arguments. + /// + /// # Examples + /// + #[cfg_attr(feature = "string", doc = "```")] + #[cfg_attr(not(feature = "string"), doc = "```ignore")] + /// # use clap_builder as clap; + /// # use clap::{Command, Arg, ArgAction}; + /// + /// let mut cmd = Command::new("foo") + /// .arg(Arg::new("bar") + /// .long("bar") + /// .action(ArgAction::SetTrue)) + /// .arg(Arg::new("baz") + /// .long("baz") + /// .action(ArgAction::SetTrue)) + /// .mut_args(|a| { + /// if let Some(l) = a.get_long().map(|l| format!("prefix-{l}")) { + /// a.long(l) + /// } else { + /// a + /// } + /// }); + /// + /// let res = cmd.try_get_matches_from_mut(vec!["foo", "--bar"]); + /// + /// // Since we changed `bar`'s long to "prefix-bar" this should err as there + /// // is no `--bar` anymore, only `--prefix-bar`. + /// + /// assert!(res.is_err()); + /// + /// let res = cmd.try_get_matches_from_mut(vec!["foo", "--prefix-bar"]); + /// assert!(res.is_ok()); + /// ``` + #[must_use] + #[cfg_attr(debug_assertions, track_caller)] + pub fn mut_args<F>(mut self, f: F) -> Self + where + F: FnMut(Arg) -> Arg, + { + self.args.mut_args(f); + self + } + /// Allows one to mutate a [`Command`] after it's been added as a subcommand. /// /// This can be useful for modifying auto-generated arguments of nested subcommands with @@ -507,7 +553,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -531,7 +577,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -559,7 +605,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -592,7 +638,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -631,7 +677,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -677,7 +723,7 @@ impl Command { /// /// # Panics /// - /// If contradictory arguments or settings exist. + /// If contradictory arguments or settings exist (debug builds). /// /// # Examples /// @@ -1124,7 +1170,6 @@ impl Command { #[cfg(feature = "color")] #[inline] #[must_use] - #[cfg(feature = "unstable-styles")] pub fn styles(mut self, styles: Styles) -> Self { self.app_ext.set(styles); self @@ -1369,6 +1414,7 @@ impl Command { /// /// # Panics /// + /// On debug builds: /// ```rust,no_run /// # use clap_builder as clap; /// # use clap::{Command, Arg}; diff --git a/vendor/clap_builder/src/builder/debug_asserts.rs b/vendor/clap_builder/src/builder/debug_asserts.rs index 29008be9f..afc181c54 100644 --- a/vendor/clap_builder/src/builder/debug_asserts.rs +++ b/vendor/clap_builder/src/builder/debug_asserts.rs @@ -746,8 +746,9 @@ fn assert_arg(arg: &Arg) { ); assert!( arg.is_takes_value_set(), - "Argument '{}` is positional, it must take a value{}", + "Argument '{}` is positional and it must take a value but action is {:?}{}", arg.get_id(), + arg.get_action(), if arg.get_id() == Id::HELP { " (`mut_arg` no longer works with implicit `--help`)" } else if arg.get_id() == Id::VERSION { diff --git a/vendor/clap_builder/src/builder/mod.rs b/vendor/clap_builder/src/builder/mod.rs index ad70911a9..320a45344 100644 --- a/vendor/clap_builder/src/builder/mod.rs +++ b/vendor/clap_builder/src/builder/mod.rs @@ -23,10 +23,7 @@ mod debug_asserts; #[cfg(test)] mod tests; -#[cfg(feature = "unstable-styles")] pub mod styling; -#[cfg(not(feature = "unstable-styles"))] -pub(crate) mod styling; pub use self::str::Str; pub use action::ArgAction; @@ -40,7 +37,6 @@ pub use range::ValueRange; pub use resettable::IntoResettable; pub use resettable::Resettable; pub use styled_str::StyledStr; -#[cfg(feature = "unstable-styles")] pub use styling::Styles; pub use value_hint::ValueHint; pub use value_parser::_AutoValueParser; @@ -57,7 +53,9 @@ pub use value_parser::PossibleValuesParser; pub use value_parser::RangedI64ValueParser; pub use value_parser::RangedU64ValueParser; pub use value_parser::StringValueParser; +pub use value_parser::TryMapValueParser; pub use value_parser::TypedValueParser; +pub use value_parser::UnknownArgumentValueParser; pub use value_parser::ValueParser; pub use value_parser::ValueParserFactory; pub use value_parser::_AnonymousValueParser; @@ -67,5 +65,3 @@ pub(crate) use self::str::Inner as StrInner; pub(crate) use action::CountType; pub(crate) use arg_settings::{ArgFlags, ArgSettings}; pub(crate) use command::AppTag; -#[cfg(not(feature = "unstable-styles"))] -pub(crate) use styling::Styles; diff --git a/vendor/clap_builder/src/builder/range.rs b/vendor/clap_builder/src/builder/range.rs index a40391545..158d02ccb 100644 --- a/vendor/clap_builder/src/builder/range.rs +++ b/vendor/clap_builder/src/builder/range.rs @@ -22,7 +22,7 @@ impl ValueRange { /// /// # Panics /// - /// If the end is less than the start + /// If the end is less than the start (debug builds) /// /// # Examples /// diff --git a/vendor/clap_builder/src/builder/styled_str.rs b/vendor/clap_builder/src/builder/styled_str.rs index d856a3015..df0f1b03b 100644 --- a/vendor/clap_builder/src/builder/styled_str.rs +++ b/vendor/clap_builder/src/builder/styled_str.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "usage"), allow(dead_code))] + /// Terminal-styling container /// /// Styling may be encoded as [ANSI Escape Code](https://en.wikipedia.org/wiki/ANSI_escape_code) @@ -47,6 +49,19 @@ impl StyledStr { self.0 = self.0.trim().to_owned() } + pub(crate) fn trim_start_lines(&mut self) { + if let Some(pos) = self.0.find('\n') { + let (leading, help) = self.0.split_at(pos + 1); + if leading.trim().is_empty() { + self.0 = help.to_owned() + } + } + } + + pub(crate) fn trim_end(&mut self) { + self.0 = self.0.trim_end().to_owned() + } + #[cfg(feature = "help")] pub(crate) fn replace_newline_var(&mut self) { self.0 = self.0.replace("{n}", "\n"); diff --git a/vendor/clap_builder/src/builder/styling.rs b/vendor/clap_builder/src/builder/styling.rs index f7f2ee1e3..3a034489b 100644 --- a/vendor/clap_builder/src/builder/styling.rs +++ b/vendor/clap_builder/src/builder/styling.rs @@ -10,7 +10,6 @@ pub use anstyle::*; /// /// clap v3 styling /// ```rust -/// # #[cfg(feature = "unstable-styles")] { /// # use clap_builder as clap; /// # use clap::builder::styling::*; /// let styles = Styles::styled() @@ -18,7 +17,6 @@ pub use anstyle::*; /// .usage(AnsiColor::Green.on_default()) /// .literal(AnsiColor::Green.on_default()) /// .placeholder(AnsiColor::Green.on_default()); -/// # } /// ``` #[derive(Clone, Debug)] #[allow(missing_copy_implementations)] // Large enough type that I want an explicit `clone()` for now diff --git a/vendor/clap_builder/src/builder/value_parser.rs b/vendor/clap_builder/src/builder/value_parser.rs index c7c7e61eb..1f0ef925f 100644 --- a/vendor/clap_builder/src/builder/value_parser.rs +++ b/vendor/clap_builder/src/builder/value_parser.rs @@ -1,6 +1,9 @@ use std::convert::TryInto; use std::ops::RangeBounds; +use crate::builder::Str; +use crate::builder::StyledStr; +use crate::parser::ValueSource; use crate::util::AnyValue; use crate::util::AnyValueId; @@ -234,8 +237,9 @@ impl ValueParser { cmd: &crate::Command, arg: Option<&crate::Arg>, value: &std::ffi::OsStr, + source: ValueSource, ) -> Result<AnyValue, crate::Error> { - self.any_value_parser().parse_ref(cmd, arg, value) + self.any_value_parser().parse_ref_(cmd, arg, value, source) } /// Describes the content of `AnyValue` @@ -592,6 +596,16 @@ trait AnyValueParser: Send + Sync + 'static { value: &std::ffi::OsStr, ) -> Result<AnyValue, crate::Error>; + fn parse_ref_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: &std::ffi::OsStr, + _source: ValueSource, + ) -> Result<AnyValue, crate::Error> { + self.parse_ref(cmd, arg, value) + } + fn parse( &self, cmd: &crate::Command, @@ -599,6 +613,16 @@ trait AnyValueParser: Send + Sync + 'static { value: std::ffi::OsString, ) -> Result<AnyValue, crate::Error>; + fn parse_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: std::ffi::OsString, + _source: ValueSource, + ) -> Result<AnyValue, crate::Error> { + self.parse(cmd, arg, value) + } + /// Describes the content of `AnyValue` fn type_id(&self) -> AnyValueId; @@ -624,6 +648,17 @@ where Ok(AnyValue::new(value)) } + fn parse_ref_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: &std::ffi::OsStr, + source: ValueSource, + ) -> Result<AnyValue, crate::Error> { + let value = ok!(TypedValueParser::parse_ref_(self, cmd, arg, value, source)); + Ok(AnyValue::new(value)) + } + fn parse( &self, cmd: &crate::Command, @@ -634,6 +669,17 @@ where Ok(AnyValue::new(value)) } + fn parse_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: std::ffi::OsString, + source: ValueSource, + ) -> Result<AnyValue, crate::Error> { + let value = ok!(TypedValueParser::parse_(self, cmd, arg, value, source)); + Ok(AnyValue::new(value)) + } + fn type_id(&self) -> AnyValueId { AnyValueId::of::<T>() } @@ -717,6 +763,19 @@ pub trait TypedValueParser: Clone + Send + Sync + 'static { /// Parse the argument value /// /// When `arg` is `None`, an external subcommand value is being parsed. + fn parse_ref_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: &std::ffi::OsStr, + _source: ValueSource, + ) -> Result<Self::Value, crate::Error> { + self.parse_ref(cmd, arg, value) + } + + /// Parse the argument value + /// + /// When `arg` is `None`, an external subcommand value is being parsed. fn parse( &self, cmd: &crate::Command, @@ -726,6 +785,19 @@ pub trait TypedValueParser: Clone + Send + Sync + 'static { self.parse_ref(cmd, arg, &value) } + /// Parse the argument value + /// + /// When `arg` is `None`, an external subcommand value is being parsed. + fn parse_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: std::ffi::OsString, + _source: ValueSource, + ) -> Result<Self::Value, crate::Error> { + self.parse(cmd, arg, value) + } + /// Reflect on enumerated value properties /// /// Error checking should not be done with this; it is mostly targeted at user-facing @@ -2086,6 +2158,122 @@ where } } +/// When encountered, report [ErrorKind::UnknownArgument][crate::error::ErrorKind::UnknownArgument] +/// +/// Useful to help users migrate, either from old versions or similar tools. +/// +/// # Examples +/// +/// ```rust +/// # use clap_builder as clap; +/// # use clap::Command; +/// # use clap::Arg; +/// let cmd = Command::new("mycmd") +/// .args([ +/// Arg::new("current-dir") +/// .short('C'), +/// Arg::new("current-dir-unknown") +/// .long("cwd") +/// .aliases(["current-dir", "directory", "working-directory", "root"]) +/// .value_parser(clap::builder::UnknownArgumentValueParser::suggest_arg("-C")) +/// .hide(true), +/// ]); +/// +/// // Use a supported version of the argument +/// let matches = cmd.clone().try_get_matches_from(["mycmd", "-C", ".."]).unwrap(); +/// assert!(matches.contains_id("current-dir")); +/// assert_eq!( +/// matches.get_many::<String>("current-dir").unwrap_or_default().map(|v| v.as_str()).collect::<Vec<_>>(), +/// vec![".."] +/// ); +/// +/// // Use one of the invalid versions +/// let err = cmd.try_get_matches_from(["mycmd", "--cwd", ".."]).unwrap_err(); +/// assert_eq!(err.kind(), clap::error::ErrorKind::UnknownArgument); +/// ``` +#[derive(Clone, Debug)] +pub struct UnknownArgumentValueParser { + arg: Option<Str>, + suggestions: Vec<StyledStr>, +} + +impl UnknownArgumentValueParser { + /// Suggest an alternative argument + pub fn suggest_arg(arg: impl Into<Str>) -> Self { + Self { + arg: Some(arg.into()), + suggestions: Default::default(), + } + } + + /// Provide a general suggestion + pub fn suggest(text: impl Into<StyledStr>) -> Self { + Self { + arg: Default::default(), + suggestions: vec![text.into()], + } + } + + /// Extend the suggestions + pub fn and_suggest(mut self, text: impl Into<StyledStr>) -> Self { + self.suggestions.push(text.into()); + self + } +} + +impl TypedValueParser for UnknownArgumentValueParser { + type Value = String; + + fn parse_ref( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + value: &std::ffi::OsStr, + ) -> Result<Self::Value, crate::Error> { + TypedValueParser::parse_ref_(self, cmd, arg, value, ValueSource::CommandLine) + } + + fn parse_ref_( + &self, + cmd: &crate::Command, + arg: Option<&crate::Arg>, + _value: &std::ffi::OsStr, + source: ValueSource, + ) -> Result<Self::Value, crate::Error> { + match source { + ValueSource::DefaultValue => { + TypedValueParser::parse_ref_(&StringValueParser::new(), cmd, arg, _value, source) + } + ValueSource::EnvVariable | ValueSource::CommandLine => { + let arg = match arg { + Some(arg) => arg.to_string(), + None => "..".to_owned(), + }; + let err = crate::Error::unknown_argument( + cmd, + arg, + self.arg.as_ref().map(|s| (s.as_str().to_owned(), None)), + false, + crate::output::Usage::new(cmd).create_usage_with_title(&[]), + ); + #[cfg(feature = "error-context")] + let err = { + debug_assert_eq!( + err.get(crate::error::ContextKind::Suggested), + None, + "Assuming `Error::unknown_argument` doesn't apply any `Suggested` so we can without caution" + ); + err.insert_context_unchecked( + crate::error::ContextKind::Suggested, + crate::error::ContextValue::StyledStrs(self.suggestions.clone()), + ) + }; + Err(err) + } + } + } +} + /// Register a type with [value_parser!][crate::value_parser!] /// /// # Example diff --git a/vendor/clap_builder/src/derive.rs b/vendor/clap_builder/src/derive.rs index 71c0e8251..7494e8461 100644 --- a/vendor/clap_builder/src/derive.rs +++ b/vendor/clap_builder/src/derive.rs @@ -1,4 +1,4 @@ -//! This module contains traits that are usable with the `#[derive(...)].` +//! This module contains traits that are usable with the `#[derive(...)]` //! macros in `clap_derive`. use crate::builder::PossibleValue; diff --git a/vendor/clap_builder/src/error/mod.rs b/vendor/clap_builder/src/error/mod.rs index 772058a5f..af90e2756 100644 --- a/vendor/clap_builder/src/error/mod.rs +++ b/vendor/clap_builder/src/error/mod.rs @@ -718,7 +718,7 @@ impl<F: ErrorFormatter> Error<F> { let mut styled_suggestion = StyledStr::new(); let _ = write!( styled_suggestion, - "'{}{sub} --{flag}{}' exists", + "'{}{sub} {flag}{}' exists", valid.render(), valid.render_reset() ); @@ -727,7 +727,7 @@ impl<F: ErrorFormatter> Error<F> { Some((flag, None)) => { err = err.insert_context_unchecked( ContextKind::SuggestedArg, - ContextValue::String(format!("--{flag}")), + ContextValue::String(flag), ); } None => {} diff --git a/vendor/clap_builder/src/lib.rs b/vendor/clap_builder/src/lib.rs index 97c32c141..7d49d41df 100644 --- a/vendor/clap_builder/src/lib.rs +++ b/vendor/clap_builder/src/lib.rs @@ -48,13 +48,6 @@ pub type Error = crate::error::Error<crate::error::DefaultFormatter>; pub use crate::derive::{Args, CommandFactory, FromArgMatches, Parser, Subcommand, ValueEnum}; -#[doc(hidden)] -pub mod __macro_refs { - #[cfg(feature = "cargo")] - #[doc(hidden)] - pub use once_cell; -} - #[macro_use] #[allow(missing_docs)] mod macros; diff --git a/vendor/clap_builder/src/macros.rs b/vendor/clap_builder/src/macros.rs index 945cdaaab..767ea94bc 100644 --- a/vendor/clap_builder/src/macros.rs +++ b/vendor/clap_builder/src/macros.rs @@ -44,9 +44,9 @@ macro_rules! crate_authors { ($sep:expr) => {{ static authors: &str = env!("CARGO_PKG_AUTHORS"); if authors.contains(':') { - static CACHED: clap::__macro_refs::once_cell::sync::Lazy<String> = - clap::__macro_refs::once_cell::sync::Lazy::new(|| authors.replace(':', $sep)); - let s: &'static str = &*CACHED; + static CACHED: std::sync::OnceLock<String> = std::sync::OnceLock::new(); + let s = CACHED.get_or_init(|| authors.replace(':', $sep)); + let s: &'static str = &*s; s } else { authors diff --git a/vendor/clap_builder/src/mkeymap.rs b/vendor/clap_builder/src/mkeymap.rs index e9d6ab844..301c7bc56 100644 --- a/vendor/clap_builder/src/mkeymap.rs +++ b/vendor/clap_builder/src/mkeymap.rs @@ -123,6 +123,15 @@ impl MKeyMap { self.args.iter_mut() } + /// Mutate every argument. + pub(crate) fn mut_args<F>(&mut self, f: F) + where + F: FnMut(Arg) -> Arg, + { + let mut args = std::mem::take(&mut self.args); + self.args.extend(args.drain(..).map(f)); + } + /// We need a lazy build here since some we may change args after creating /// the map, you can checkout who uses `args_mut`. pub(crate) fn _build(&mut self) { diff --git a/vendor/clap_builder/src/output/help.rs b/vendor/clap_builder/src/output/help.rs index 410616eb1..a5073a9e4 100644 --- a/vendor/clap_builder/src/output/help.rs +++ b/vendor/clap_builder/src/output/help.rs @@ -30,8 +30,10 @@ pub(crate) fn write_help(writer: &mut StyledStr, cmd: &Command, usage: &Usage<'_ } } - // Remove any extra lines caused by book keeping - writer.trim(); + // Remove any lines from unused sections + writer.trim_start_lines(); + // Remove any whitespace caused by book keeping + writer.trim_end(); // Ensure there is still a trailing newline writer.push_str("\n"); } diff --git a/vendor/clap_builder/src/parser/matches/arg_matches.rs b/vendor/clap_builder/src/parser/matches/arg_matches.rs index 525904291..8390b0b58 100644 --- a/vendor/clap_builder/src/parser/matches/arg_matches.rs +++ b/vendor/clap_builder/src/parser/matches/arg_matches.rs @@ -237,7 +237,7 @@ impl ArgMatches { /// /// # Panics /// - /// If the argument definition and access mismatch. To handle this case programmatically, see + /// If the argument definition and access mismatch (debug builds). To handle this case programmatically, see /// [`ArgMatches::try_get_occurrences`]. /// /// # Examples @@ -490,7 +490,7 @@ impl ArgMatches { /// /// # Panics /// - /// If `id` is not a valid argument or group name. To handle this case programmatically, see + /// If `id` is not a valid argument or group name (debug builds). To handle this case programmatically, see /// [`ArgMatches::try_contains_id`]. /// /// # Examples @@ -570,7 +570,7 @@ impl ArgMatches { /// /// # Panics /// - /// If `id` is not a valid argument or group id. + /// If `id` is not a valid argument or group id (debug builds). /// /// # Examples /// @@ -617,7 +617,7 @@ impl ArgMatches { /// /// # Panics /// - /// If `id` is not a valid argument or group id. + /// If `id` is not a valid argument or group id (debug builds). /// /// # Examples /// @@ -765,7 +765,7 @@ impl ArgMatches { /// /// # Panics /// - /// If `id` is not a valid argument or group id. + /// If `id` is not a valid argument or group id (debug builds). /// /// # Examples /// @@ -969,7 +969,7 @@ impl ArgMatches { /// /// # Panics /// - /// If `id` is not a valid subcommand. + /// If `id` is not a valid subcommand (debug builds). /// /// # Examples /// diff --git a/vendor/clap_builder/src/parser/parser.rs b/vendor/clap_builder/src/parser/parser.rs index d6d8e8da4..fcde4a86e 100644 --- a/vendor/clap_builder/src/parser/parser.rs +++ b/vendor/clap_builder/src/parser/parser.rs @@ -421,7 +421,12 @@ impl<'cmd> Parser<'cmd> { sc_m.start_occurrence_of_external(self.cmd); for raw_val in raw_args.remaining(&mut args_cursor) { - let val = ok!(external_parser.parse_ref(self.cmd, None, raw_val)); + let val = ok!(external_parser.parse_ref( + self.cmd, + None, + raw_val, + ValueSource::CommandLine + )); let external_id = Id::from_static_ref(Id::EXTERNAL); sc_m.add_val_to(&external_id, val, raw_val.to_os_string()); } @@ -539,19 +544,24 @@ impl<'cmd> Parser<'cmd> { if self.cmd.is_infer_subcommands_set() { // For subcommand `test`, we accepts it's prefix: `t`, `te`, // `tes` and `test`. - let v = self - .cmd - .all_subcommand_names() - .filter(|s| s.starts_with(arg)) - .collect::<Vec<_>>(); + let mut iter = self.cmd.get_subcommands().filter_map(|s| { + if s.get_name().starts_with(arg) { + return Some(s.get_name()); + } - if v.len() == 1 { - return Some(v[0]); - } + // Use find here instead of chaining the iterator because we want to accept + // conflicts in aliases. + s.get_all_aliases().find(|s| s.starts_with(arg)) + }); - // If there is any ambiguity, fallback to non-infer subcommand - // search. + if let name @ Some(_) = iter.next() { + if iter.next().is_none() { + return name; + } + } } + // Don't use an else here because we want inference to support exact matching even if + // there are conflicts. if let Some(sc) = self.cmd.find_subcommand(arg) { return Some(sc.get_name()); } @@ -563,28 +573,29 @@ impl<'cmd> Parser<'cmd> { fn possible_long_flag_subcommand(&self, arg: &str) -> Option<&str> { debug!("Parser::possible_long_flag_subcommand: arg={arg:?}"); if self.cmd.is_infer_subcommands_set() { - let options = self - .cmd - .get_subcommands() - .fold(Vec::new(), |mut options, sc| { - if let Some(long) = sc.get_long_flag() { - if long.starts_with(arg) { - options.push(long); - } - options.extend(sc.get_all_aliases().filter(|alias| alias.starts_with(arg))) + let mut iter = self.cmd.get_subcommands().filter_map(|sc| { + sc.get_long_flag().and_then(|long| { + if long.starts_with(arg) { + Some(sc.get_name()) + } else { + sc.get_all_long_flag_aliases().find_map(|alias| { + if alias.starts_with(arg) { + Some(sc.get_name()) + } else { + None + } + }) } - options - }); - if options.len() == 1 { - return Some(options[0]); - } + }) + }); - for sc in options { - if sc == arg { - return Some(sc); + if let name @ Some(_) = iter.next() { + if iter.next().is_none() { + return name; } } - } else if let Some(sc_name) = self.cmd.find_long_subcmd(arg) { + } + if let Some(sc_name) = self.cmd.find_long_subcmd(arg) { return Some(sc_name); } None @@ -1032,6 +1043,7 @@ impl<'cmd> Parser<'cmd> { &self, arg: &Arg, raw_vals: Vec<OsString>, + source: ValueSource, matcher: &mut ArgMatcher, ) -> ClapResult<()> { debug!("Parser::push_arg_values: {raw_vals:?}"); @@ -1044,7 +1056,7 @@ impl<'cmd> Parser<'cmd> { self.cur_idx.get() ); let value_parser = arg.get_value_parser(); - let val = ok!(value_parser.parse_ref(self.cmd, Some(arg), &raw_val)); + let val = ok!(value_parser.parse_ref(self.cmd, Some(arg), &raw_val, source)); matcher.add_val_to(arg.get_id(), val, raw_val); matcher.add_index_to(arg.get_id(), self.cur_idx.get()); @@ -1153,7 +1165,7 @@ impl<'cmd> Parser<'cmd> { )); } self.start_custom_arg(matcher, arg, source); - ok!(self.push_arg_values(arg, raw_vals, matcher)); + ok!(self.push_arg_values(arg, raw_vals, source, matcher)); if cfg!(debug_assertions) && matcher.needs_more_vals(arg) { debug!( "Parser::react not enough values passed in, leaving it to the validator to complain", @@ -1170,7 +1182,7 @@ impl<'cmd> Parser<'cmd> { debug!("Parser::react: cur_idx:={}", self.cur_idx.get()); } self.start_custom_arg(matcher, arg, source); - ok!(self.push_arg_values(arg, raw_vals, matcher)); + ok!(self.push_arg_values(arg, raw_vals, source, matcher)); if cfg!(debug_assertions) && matcher.needs_more_vals(arg) { debug!( "Parser::react not enough values passed in, leaving it to the validator to complain", @@ -1196,7 +1208,7 @@ impl<'cmd> Parser<'cmd> { )); } self.start_custom_arg(matcher, arg, source); - ok!(self.push_arg_values(arg, raw_vals, matcher)); + ok!(self.push_arg_values(arg, raw_vals, source, matcher)); Ok(ParseResult::ValuesDone) } ArgAction::SetFalse => { @@ -1217,7 +1229,7 @@ impl<'cmd> Parser<'cmd> { )); } self.start_custom_arg(matcher, arg, source); - ok!(self.push_arg_values(arg, raw_vals, matcher)); + ok!(self.push_arg_values(arg, raw_vals, source, matcher)); Ok(ParseResult::ValuesDone) } ArgAction::Count => { @@ -1233,7 +1245,7 @@ impl<'cmd> Parser<'cmd> { matcher.remove(arg.get_id()); self.start_custom_arg(matcher, arg, source); - ok!(self.push_arg_values(arg, raw_vals, matcher)); + ok!(self.push_arg_values(arg, raw_vals, source, matcher)); Ok(ParseResult::ValuesDone) } ArgAction::Help => { @@ -1521,6 +1533,7 @@ impl<'cmd> Parser<'cmd> { self.start_custom_arg(matcher, arg, ValueSource::CommandLine); } } + let did_you_mean = did_you_mean.map(|(arg, cmd)| (format!("--{arg}"), cmd)); let required = self.cmd.required_graph(); let used: Vec<Id> = matcher |