summaryrefslogtreecommitdiffstats
path: root/vendor/clap/src/_derive
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/clap/src/_derive
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap/src/_derive')
-rw-r--r--vendor/clap/src/_derive/_tutorial.rs7
-rw-r--r--vendor/clap/src/_derive/mod.rs14
2 files changed, 17 insertions, 4 deletions
diff --git a/vendor/clap/src/_derive/_tutorial.rs b/vendor/clap/src/_derive/_tutorial.rs
index eb95c8754..8d00b03ec 100644
--- a/vendor/clap/src/_derive/_tutorial.rs
+++ b/vendor/clap/src/_derive/_tutorial.rs
@@ -75,7 +75,7 @@
#![doc = include_str!("../../examples/tutorial_derive/03_03_positional.md")]
//!
//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To
-//! accept multiple values, use [`Append`][crate::ArgAction::Append]:
+//! accept multiple values, use [`Append`][crate::ArgAction::Append] via `Vec`:
//! ```rust
#![doc = include_str!("../../examples/tutorial_derive/03_03_positional_mult.rs")]
//! ```
@@ -98,7 +98,7 @@
#![doc = include_str!("../../examples/tutorial_derive/03_02_option.md")]
//!
//! Note that the default [`ArgAction`][crate::ArgAction] is [`Set`][crate::ArgAction::Set]. To
-//! accept multiple occurrences, use [`Append`][crate::ArgAction::Append]:
+//! accept multiple occurrences, use [`Append`][crate::ArgAction::Append] via `Vec`:
//! ```rust
#![doc = include_str!("../../examples/tutorial_derive/03_02_option_mult.rs")]
//! ```
@@ -202,6 +202,9 @@
//! want one of them to be required, but making all of them required isn't feasible because perhaps
//! they conflict with each other.
//!
+//! [`ArgGroup`][crate::ArgGroup]s are automatically created for a `struct` with its
+//! [`ArgGroup::id`][crate::ArgGroup::id] being the struct's name.
+//!
//! ```rust
#![doc = include_str!("../../examples/tutorial_derive/04_03_relations.rs")]
//! ```
diff --git a/vendor/clap/src/_derive/mod.rs b/vendor/clap/src/_derive/mod.rs
index a92b7c87b..2e4a4902d 100644
--- a/vendor/clap/src/_derive/mod.rs
+++ b/vendor/clap/src/_derive/mod.rs
@@ -194,7 +194,14 @@
//! These correspond to the [`ArgGroup`][crate::ArgGroup] which is implicitly created for each
//! `Args` derive.
//!
-//! At the moment, only `#[group(skip)]` is supported
+//! **Raw attributes:** Any [`ArgGroup` method][crate::ArgGroup] can also be used as an attribute, see [Terminology](#terminology) for syntax.
+//! - e.g. `#[group(required = true)]` would translate to `arg_group.required(true)`
+//!
+//! **Magic attributes**:
+//! - `id = <expr>`: [`ArgGroup::id`][crate::ArgGroup::id]
+//! - When not present: struct's name is used
+//! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`
+//! - Without `<expr>`: fills the field with `Default::default()`
//!
//! ### Arg Attributes
//!
@@ -205,7 +212,7 @@
//!
//! **Magic attributes**:
//! - `id = <expr>`: [`Arg::id`][crate::Arg::id]
-//! - When not present: case-converted field name is used
+//! - When not present: field's name is used
//! - `value_parser [= <expr>]`: [`Arg::value_parser`][crate::Arg::value_parser]
//! - When not present: will auto-select an implementation based on the field type using
//! [`value_parser!`][crate::value_parser!]
@@ -284,6 +291,9 @@
//!
//! Notes:
//! - For custom type behavior, you can override the implied attributes/settings and/or set additional ones
+//! - To force any inferred type (like `Vec<T>`) to be treated as `T`, you can refer to the type
+//! by another means, like using `std::vec::Vec` instead of `Vec`. For improving this, see
+//! [#4626](https://github.com/clap-rs/clap/issues/4626).
//! - `Option<Vec<T>>` will be `None` instead of `vec![]` if no arguments are provided.
//! - This gives the user some flexibility in designing their argument, like with `num_args(0..)`
//!