Skip to content

Commit 6b18d77

Browse files
committed
docs(derive): Acknowledge Vec<Vec<T>>
1 parent 5efa52a commit 6b18d77

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/_derive/mod.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,17 @@
291291
//!
292292
//! `clap` assumes some intent based on the type used:
293293
//!
294-
//! | Type | Effect | Implies |
295-
//! |---------------------|--------------------------------------|-------------------------------------------------------------|
296-
//! | `()` | user-defined | `.action(ArgAction::Set).required(false)` |
297-
//! | `bool` | flag | `.action(ArgAction::SetTrue)` |
298-
//! | `Option<T>` | optional argument | `.action(ArgAction::Set).required(false)` |
299-
//! | `Option<Option<T>>` | optional value for optional argument | `.action(ArgAction::Set).required(false).num_args(0..=1)` |
300-
//! | `T` | required argument | `.action(ArgAction::Set).required(!has_default)` |
301-
//! | `Vec<T>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` |
302-
//! | `Option<Vec<T>>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` |
294+
//! | Type | Effect | Implies | Notes |
295+
//! |-----------------------|------------------------------------------------------|-------------------------------------------------------------|-------|
296+
//! | `()` | user-defined | `.action(ArgAction::Set).required(false)` | |
297+
//! | `bool` | flag | `.action(ArgAction::SetTrue)` | |
298+
//! | `Option<T>` | optional argument | `.action(ArgAction::Set).required(false)` | |
299+
//! | `Option<Option<T>>` | optional value for optional argument | `.action(ArgAction::Set).required(false).num_args(0..=1)` | |
300+
//! | `T` | required argument | `.action(ArgAction::Set).required(!has_default)` | |
301+
//! | `Vec<T>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | |
302+
//! | `Option<Vec<T>>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | |
303+
//! | `Vec<Vec<T>>` | `0..` occurrences of argument, grouped by occurrence | `.action(ArgAction::Append).required(false)` | requires `unstable-v5` |
304+
//! | `Option<Vec<Vec<T>>>` | `0..` occurrences of argument, grouped by occurrence | `.action(ArgAction::Append).required(false)` | requires `unstable-v5` |
303305
//!
304306
//! In addition, [`.value_parser(value_parser!(T))`][crate::value_parser!] is called for each
305307
//! field.
@@ -309,8 +311,9 @@
309311
//! - To force any inferred type (like `Vec<T>`) to be treated as `T`, you can refer to the type
310312
//! by another means, like using `std::vec::Vec` instead of `Vec`. For improving this, see
311313
//! [#4626](https://github.com/clap-rs/clap/issues/4626).
312-
//! - `Option<Vec<T>>` will be `None` instead of `vec![]` if no arguments are provided.
314+
//! - `Option<Vec<T>>` and `Option<Vec<Vec<T>>` will be `None` instead of `vec![]` if no arguments are provided.
313315
//! - This gives the user some flexibility in designing their argument, like with `num_args(0..)`
316+
//! - `Vec<Vec<T>>` will need [`Arg::num_args`][crate::Arg::num_args] set to be meaningful
314317
//!
315318
//! ## Doc Comments
316319
//!

0 commit comments

Comments
 (0)