summaryrefslogtreecommitdiffstats
path: root/vendor/clap_derive
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/clap_derive')
-rw-r--r--vendor/clap_derive/.cargo-checksum.json2
-rw-r--r--vendor/clap_derive/Cargo.toml5
-rw-r--r--vendor/clap_derive/LICENSE-MIT2
-rw-r--r--vendor/clap_derive/README.md4
-rw-r--r--vendor/clap_derive/src/attrs.rs159
-rw-r--r--vendor/clap_derive/src/derives/value_enum.rs2
-rw-r--r--vendor/clap_derive/src/parse.rs4
7 files changed, 167 insertions, 11 deletions
diff --git a/vendor/clap_derive/.cargo-checksum.json b/vendor/clap_derive/.cargo-checksum.json
index 8d3303f99..1dfa35a62 100644
--- a/vendor/clap_derive/.cargo-checksum.json
+++ b/vendor/clap_derive/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"29d214d0c807739f6d147a1a472dfab5d929b4dd31623f670df28a713be107e8","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"6725d1437fc6c77301f2ff0e7d52914cf4f9509213e1078dc77d9356dbe6eac5","README.md":"d99fca4ba5976a41b150cd7f5c17100e0d275b9bf48b51a0d964115dc81e20b9","src/attrs.rs":"dd4288ac38aeb184bbffade71af48706034f10d311068af2917c0f96d813698a","src/derives/args.rs":"27a13d33f24f7f7668c82fa653978e909514bd39e808c7996fddb0d3a3c0e570","src/derives/into_app.rs":"02c36d403ad35e3d49de6042cacecf2a724561b5e3948b5aec4b45646e031877","src/derives/mod.rs":"ff7947fddee4b3d8365e29459a02458382e13df022aee822e09bce1ac255d3bb","src/derives/parser.rs":"9ca609e6e5bfb303e22b4ecb8aca9035571179920b0df91031e9f987559252e0","src/derives/subcommand.rs":"0513c48013c2bd9f450ffc7bfcbf84b3a3290e37ff571dd070798356c2b291ac","src/derives/value_enum.rs":"27b87ccb6829925f6ffa631109217bffd81b74f61519841678bd6d8c5cfcbe40","src/dummies.rs":"02f111bbd84b8f0525faeb9189c59cb2fd2df05ae6c7b014735c82feac5ff23f","src/lib.rs":"e4be47e8db06a6555a2a4cd1802d17c16a3b51ae0ec291b3ec75ef2b6517eb0e","src/parse.rs":"f0d720da5477755bdce02fcd248a57efe74b2fbbc5e07c5dc17d9bf78b017958","src/utils/doc_comments.rs":"386859b274fd1e298aeaeafd2b20764db0957cbb4e6c9e8bab52a506a0b8ecda","src/utils/mod.rs":"ee28526587d2d80d5dba162f28191f44f6a0c296d0e52225eb74b90534d49b25","src/utils/spanned.rs":"e93600124c54985533f74fe23f096f4ada94b310eff97a16f0ce40fb0f690a3b","src/utils/ty.rs":"0a9b8c5dabfa28388b60423f4b6075a275b347258ac35301997cb0d7f763607f"},"package":"c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"} \ No newline at end of file
+{"files":{"Cargo.toml":"eaf10a4c685b527f604ea9f84fbe7095e15fe4424225c57481d0555a89dfb054","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"4ec07b9c59a2ddcedcdc9d21d51c147b18157794b03ff2ea5ae57f2b5236943d","src/attrs.rs":"1c95a75fd377d19587f429d3f51544ac0ca96f868cce4ffe12d1163f7465fa73","src/derives/args.rs":"27a13d33f24f7f7668c82fa653978e909514bd39e808c7996fddb0d3a3c0e570","src/derives/into_app.rs":"02c36d403ad35e3d49de6042cacecf2a724561b5e3948b5aec4b45646e031877","src/derives/mod.rs":"ff7947fddee4b3d8365e29459a02458382e13df022aee822e09bce1ac255d3bb","src/derives/parser.rs":"9ca609e6e5bfb303e22b4ecb8aca9035571179920b0df91031e9f987559252e0","src/derives/subcommand.rs":"0513c48013c2bd9f450ffc7bfcbf84b3a3290e37ff571dd070798356c2b291ac","src/derives/value_enum.rs":"4d0958d3a767c82f2366d8fda20367c5aa033af616d09ef581e8abdb2e029a70","src/dummies.rs":"02f111bbd84b8f0525faeb9189c59cb2fd2df05ae6c7b014735c82feac5ff23f","src/lib.rs":"e4be47e8db06a6555a2a4cd1802d17c16a3b51ae0ec291b3ec75ef2b6517eb0e","src/parse.rs":"ceaac282cabccfac5bcf56ce02095c9acbf00dbfdd3c3009fa58e87bdde46218","src/utils/doc_comments.rs":"386859b274fd1e298aeaeafd2b20764db0957cbb4e6c9e8bab52a506a0b8ecda","src/utils/mod.rs":"ee28526587d2d80d5dba162f28191f44f6a0c296d0e52225eb74b90534d49b25","src/utils/spanned.rs":"e93600124c54985533f74fe23f096f4ada94b310eff97a16f0ce40fb0f690a3b","src/utils/ty.rs":"0a9b8c5dabfa28388b60423f4b6075a275b347258ac35301997cb0d7f763607f"},"package":"ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"} \ No newline at end of file
diff --git a/vendor/clap_derive/Cargo.toml b/vendor/clap_derive/Cargo.toml
index 49e3fd963..f74476e68 100644
--- a/vendor/clap_derive/Cargo.toml
+++ b/vendor/clap_derive/Cargo.toml
@@ -11,9 +11,9 @@
[package]
edition = "2021"
-rust-version = "1.56.0"
+rust-version = "1.56.1"
name = "clap_derive"
-version = "3.2.5"
+version = "3.2.18"
include = [
"build.rs",
"src/**/*",
@@ -24,7 +24,6 @@ include = [
"examples/**/*",
]
description = "Parse command line argument by defining a struct, derive crate."
-documentation = "https://docs.rs/clap_derive"
readme = "README.md"
keywords = [
"clap",
diff --git a/vendor/clap_derive/LICENSE-MIT b/vendor/clap_derive/LICENSE-MIT
index 5acedf041..7b05b8453 100644
--- a/vendor/clap_derive/LICENSE-MIT
+++ b/vendor/clap_derive/LICENSE-MIT
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2015-2016 Kevin B. Knapp
+Copyright (c) 2015-2022 Kevin B. Knapp and Clap Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/clap_derive/README.md b/vendor/clap_derive/README.md
index 1acadb355..17f649eda 100644
--- a/vendor/clap_derive/README.md
+++ b/vendor/clap_derive/README.md
@@ -3,8 +3,8 @@
Macro implementation for clap's derives.
[docs.rs](https://docs.rs/clap)
-- [Derive Tutorial](https://github.com/clap-rs/clap/blob/v3.2.5/examples/tutorial_derive/README.md)
-- [Derive Reference](https://github.com/clap-rs/clap/blob/v3.2.5/examples/derive_ref/README.md)
+- [Derive Tutorial](https://github.com/clap-rs/clap/blob/v3.2.18/examples/tutorial_derive/README.md)
+- [Derive Reference](https://github.com/clap-rs/clap/blob/v3.2.18/examples/derive_ref/README.md)
## License
diff --git a/vendor/clap_derive/src/attrs.rs b/vendor/clap_derive/src/attrs.rs
index 3c685fbe8..2c5b47d95 100644
--- a/vendor/clap_derive/src/attrs.rs
+++ b/vendor/clap_derive/src/attrs.rs
@@ -450,7 +450,7 @@ impl Attrs {
}
fn push_method(&mut self, name: Ident, arg: impl ToTokens) {
- if name == "name" {
+ if name == "name" || name == "id" {
self.name = Name::Assigned(quote!(#arg));
} else if name == "value_parser" {
self.value_parser = Some(ValueParser::Explicit(Method::new(name, quote!(#arg))));
@@ -552,7 +552,7 @@ impl Attrs {
})
} else {
quote_spanned!(ident.span()=> {
- static DEFAULT_VALUE: clap::once_cell::sync::Lazy<String> = clap::once_cell::sync::Lazy::new(|| {
+ static DEFAULT_VALUE: clap::__macro_refs::once_cell::sync::Lazy<String> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
let val: #ty = #val;
::std::string::ToString::to_string(&val)
});
@@ -564,6 +564,81 @@ impl Attrs {
self.methods.push(Method::new(raw_ident, val));
}
+ DefaultValuesT(ident, expr) => {
+ let ty = if let Some(ty) = self.ty.as_ref() {
+ ty
+ } else {
+ abort!(
+ ident,
+ "#[clap(default_values_t)] (without an argument) can be used \
+ only on field level";
+
+ note = "see \
+ https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+ };
+
+ let container_type = Ty::from_syn_ty(ty);
+ if *container_type != Ty::Vec {
+ abort!(
+ ident,
+ "#[clap(default_values_t)] can be used only on Vec types";
+
+ note = "see \
+ https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+ }
+ let inner_type = inner_type(ty);
+
+ // Use `Borrow<#inner_type>` so we accept `&Vec<#inner_type>` and
+ // `Vec<#inner_type>`.
+ let val = if parsed.iter().any(|a| matches!(a, ValueEnum(_))) {
+ quote_spanned!(ident.span()=> {
+ {
+ fn iter_to_vals<T>(iterable: impl IntoIterator<Item = T>) -> Vec<&'static str>
+ where
+ T: ::std::borrow::Borrow<#inner_type>
+ {
+ iterable
+ .into_iter()
+ .map(|val| {
+ clap::ValueEnum::to_possible_value(val.borrow()).unwrap().get_name()
+ })
+ .collect()
+
+ }
+
+ static DEFAULT_VALUES: clap::__macro_refs::once_cell::sync::Lazy<Vec<&str>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ iter_to_vals(#expr)
+ });
+ &*DEFAULT_VALUES.as_slice()
+ }
+ })
+ } else {
+ quote_spanned!(ident.span()=> {
+ {
+ fn iter_to_vals<T>(iterable: impl IntoIterator<Item = T>) -> Vec<String>
+ where
+ T: ::std::borrow::Borrow<#inner_type>
+ {
+ iterable.into_iter().map(|val| val.borrow().to_string()).collect()
+
+ }
+
+ static DEFAULT_STRINGS: clap::__macro_refs::once_cell::sync::Lazy<Vec<::std::string::String>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ iter_to_vals(#expr)
+ });
+
+ static DEFAULT_VALUES: clap::__macro_refs::once_cell::sync::Lazy<Vec<&str>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ DEFAULT_STRINGS.iter().map(::std::string::String::as_str).collect()
+ });
+ &*DEFAULT_VALUES.as_slice()
+ }
+ })
+ };
+
+ self.methods
+ .push(Method::new(Ident::new("default_values", ident.span()), val));
+ }
+
DefaultValueOsT(ident, expr) => {
let ty = if let Some(ty) = self.ty.as_ref() {
ty
@@ -592,7 +667,7 @@ impl Attrs {
})
} else {
quote_spanned!(ident.span()=> {
- static DEFAULT_VALUE: clap::once_cell::sync::Lazy<::std::ffi::OsString> = clap::once_cell::sync::Lazy::new(|| {
+ static DEFAULT_VALUE: clap::__macro_refs::once_cell::sync::Lazy<::std::ffi::OsString> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
let val: #ty = #val;
::std::ffi::OsString::from(val)
});
@@ -604,6 +679,84 @@ impl Attrs {
self.methods.push(Method::new(raw_ident, val));
}
+ DefaultValuesOsT(ident, expr) => {
+ let ty = if let Some(ty) = self.ty.as_ref() {
+ ty
+ } else {
+ abort!(
+ ident,
+ "#[clap(default_values_os_t)] (without an argument) can be used \
+ only on field level";
+
+ note = "see \
+ https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+ };
+
+ let container_type = Ty::from_syn_ty(ty);
+ if *container_type != Ty::Vec {
+ abort!(
+ ident,
+ "#[clap(default_values_os_t)] can be used only on Vec types";
+
+ note = "see \
+ https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+ }
+ let inner_type = inner_type(ty);
+
+ // Use `Borrow<#inner_type>` so we accept `&Vec<#inner_type>` and
+ // `Vec<#inner_type>`.
+ let val = if parsed.iter().any(|a| matches!(a, ValueEnum(_))) {
+ quote_spanned!(ident.span()=> {
+ {
+ fn iter_to_vals<T>(iterable: impl IntoIterator<Item = T>) -> Vec<&'static ::std::ffi::OsStr>
+ where
+ T: ::std::borrow::Borrow<#inner_type>
+ {
+ iterable
+ .into_iter()
+ .map(|val| {
+ clap::ValueEnum::to_possible_value(val.borrow()).unwrap().get_name()
+ })
+ .map(::std::ffi::OsStr::new)
+ .collect()
+
+ }
+
+ static DEFAULT_VALUES: clap::__macro_refs::once_cell::sync::Lazy<Vec<&::std::ffi::OsStr>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ iter_to_vals(#expr)
+ });
+ &*DEFAULT_VALUES.as_slice()
+ }
+ })
+ } else {
+ quote_spanned!(ident.span()=> {
+ {
+ fn iter_to_vals<T>(iterable: impl IntoIterator<Item = T>) -> Vec<::std::ffi::OsString>
+ where
+ T: ::std::borrow::Borrow<#inner_type>
+ {
+ iterable.into_iter().map(|val| val.borrow().into()).collect()
+
+ }
+
+ static DEFAULT_OS_STRINGS: clap::__macro_refs::once_cell::sync::Lazy<Vec<::std::ffi::OsString>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ iter_to_vals(#expr)
+ });
+
+ static DEFAULT_VALUES: clap::__macro_refs::once_cell::sync::Lazy<Vec<&::std::ffi::OsStr>> = clap::__macro_refs::once_cell::sync::Lazy::new(|| {
+ DEFAULT_OS_STRINGS.iter().map(::std::ffi::OsString::as_os_str).collect()
+ });
+ &*DEFAULT_VALUES.as_slice()
+ }
+ })
+ };
+
+ self.methods.push(Method::new(
+ Ident::new("default_values_os", ident.span()),
+ val,
+ ));
+ }
+
NextDisplayOrder(ident, expr) => {
self.next_display_order = Some(Method::new(ident, quote!(#expr)));
}
diff --git a/vendor/clap_derive/src/derives/value_enum.rs b/vendor/clap_derive/src/derives/value_enum.rs
index b18b665c4..06d514f0e 100644
--- a/vendor/clap_derive/src/derives/value_enum.rs
+++ b/vendor/clap_derive/src/derives/value_enum.rs
@@ -84,7 +84,7 @@ fn lits(
None
} else {
if !matches!(variant.fields, Fields::Unit) {
- abort!(variant.span(), "`#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped");
+ abort!(variant.span(), "`#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped");
}
let fields = attrs.field_methods(false);
let name = attrs.cased_name();
diff --git a/vendor/clap_derive/src/parse.rs b/vendor/clap_derive/src/parse.rs
index 253736cfd..7d7e19cdc 100644
--- a/vendor/clap_derive/src/parse.rs
+++ b/vendor/clap_derive/src/parse.rs
@@ -53,7 +53,9 @@ pub enum ClapAttr {
// ident = arbitrary_expr
NameExpr(Ident, Expr),
DefaultValueT(Ident, Option<Expr>),
+ DefaultValuesT(Ident, Expr),
DefaultValueOsT(Ident, Option<Expr>),
+ DefaultValuesOsT(Ident, Expr),
NextDisplayOrder(Ident, Expr),
NextHelpHeading(Ident, Expr),
HelpHeading(Ident, Expr),
@@ -122,7 +124,9 @@ impl Parse for ClapAttr {
Ok(expr) => match &*name_str {
"skip" => Ok(Skip(name, Some(expr))),
"default_value_t" => Ok(DefaultValueT(name, Some(expr))),
+ "default_values_t" => Ok(DefaultValuesT(name, expr)),
"default_value_os_t" => Ok(DefaultValueOsT(name, Some(expr))),
+ "default_values_os_t" => Ok(DefaultValuesOsT(name, expr)),
"next_display_order" => Ok(NextDisplayOrder(name, expr)),
"next_help_heading" => Ok(NextHelpHeading(name, expr)),
"help_heading" => Ok(HelpHeading(name, expr)),