From 6b18d7725c6077a3da955d199617eb1fb3b88ea2 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 24 Jul 2024 10:48:05 -0500 Subject: [PATCH] docs(derive): Acknowledge Vec> --- src/_derive/mod.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/_derive/mod.rs b/src/_derive/mod.rs index 7ef6dd4ec62..b1c0b2174b0 100644 --- a/src/_derive/mod.rs +++ b/src/_derive/mod.rs @@ -291,15 +291,17 @@ //! //! `clap` assumes some intent based on the type used: //! -//! | Type | Effect | Implies | -//! |---------------------|--------------------------------------|-------------------------------------------------------------| -//! | `()` | user-defined | `.action(ArgAction::Set).required(false)` | -//! | `bool` | flag | `.action(ArgAction::SetTrue)` | -//! | `Option` | optional argument | `.action(ArgAction::Set).required(false)` | -//! | `Option>` | optional value for optional argument | `.action(ArgAction::Set).required(false).num_args(0..=1)` | -//! | `T` | required argument | `.action(ArgAction::Set).required(!has_default)` | -//! | `Vec` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | -//! | `Option>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | +//! | Type | Effect | Implies | Notes | +//! |-----------------------|------------------------------------------------------|-------------------------------------------------------------|-------| +//! | `()` | user-defined | `.action(ArgAction::Set).required(false)` | | +//! | `bool` | flag | `.action(ArgAction::SetTrue)` | | +//! | `Option` | optional argument | `.action(ArgAction::Set).required(false)` | | +//! | `Option>` | optional value for optional argument | `.action(ArgAction::Set).required(false).num_args(0..=1)` | | +//! | `T` | required argument | `.action(ArgAction::Set).required(!has_default)` | | +//! | `Vec` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | | +//! | `Option>` | `0..` occurrences of argument | `.action(ArgAction::Append).required(false)` | | +//! | `Vec>` | `0..` occurrences of argument, grouped by occurrence | `.action(ArgAction::Append).required(false)` | requires `unstable-v5` | +//! | `Option>>` | `0..` occurrences of argument, grouped by occurrence | `.action(ArgAction::Append).required(false)` | requires `unstable-v5` | //! //! In addition, [`.value_parser(value_parser!(T))`][crate::value_parser!] is called for each //! field. @@ -309,8 +311,9 @@ //! - To force any inferred type (like `Vec`) 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>` will be `None` instead of `vec![]` if no arguments are provided. +//! - `Option>` and `Option>` 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..)` +//! - `Vec>` will need [`Arg::num_args`][crate::Arg::num_args] set to be meaningful //! //! ## Doc Comments //!