Skip to content

Commit bf39b8d

Browse files
committed
docs(ref): Move flatten/subcommand to be under command attr
Fixes #4505
1 parent 3262016 commit bf39b8d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/_derive/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@
177177
//! - `external_subcommand`: [`Command::allow_external_subcommand(true)`][crate::Command::allow_external_subcommands]
178178
//! - Variant must be either `Variant(Vec<String>)` or `Variant(Vec<OsString>)`
179179
//!
180+
//! And for [`Args`][crate::Args] fields:
181+
//! - `flatten`: Delegates to the field for more arguments (must implement [`Args`][crate::Args])
182+
//! - Only [`next_help_heading`][crate::Command::next_help_heading] can be used with `flatten`. See
183+
//! [clap-rs/clap#3269](https://github.com/clap-rs/clap/issues/3269) for why
184+
//! arg attributes are not generally supported.
185+
//! - **Tip:** Though we do apply a flattened [`Args`][crate::Args]'s Parent Command Attributes, this
186+
//! makes reuse harder. Generally prefer putting the cmd attributes on the
187+
//! [`Parser`][crate::Parser] or on the flattened field.
188+
//! - `subcommand`: Delegates definition of subcommands to the field (must implement
189+
//! [`Subcommand`][crate::Subcommand])
190+
//! - When `Option<T>`, the subcommand becomes optional
191+
//!
180192
//! ### ArgGroup Attributes
181193
//!
182194
//! These correspond to the [`ArgGroup`][crate::ArgGroup] which is implicitly created for each
@@ -214,16 +226,6 @@
214226
//! - `env [= <str>]`: [`Arg::env`][crate::Arg::env] (needs [`env` feature][crate::_features] enabled)
215227
//! - When not present: no env set
216228
//! - Without `<str>`: defaults to the case-converted field name
217-
//! - `flatten`: Delegates to the field for more arguments (must implement [`Args`][crate::Args])
218-
//! - Only [`next_help_heading`][crate::Command::next_help_heading] can be used with `flatten`. See
219-
//! [clap-rs/clap#3269](https://github.com/clap-rs/clap/issues/3269) for why
220-
//! arg attributes are not generally supported.
221-
//! - **Tip:** Though we do apply a flattened [`Args`][crate::Args]'s Parent Command Attributes, this
222-
//! makes reuse harder. Generally prefer putting the cmd attributes on the
223-
//! [`Parser`][crate::Parser] or on the flattened field.
224-
//! - `subcommand`: Delegates definition of subcommands to the field (must implement
225-
//! [`Subcommand`][crate::Subcommand])
226-
//! - When `Option<T>`, the subcommand becomes optional
227229
//! - `from_global`: Read a [`Arg::global`][crate::Arg::global] argument (raw attribute), regardless of what subcommand you are in
228230
//! - `value_enum`: Parse the value using the [`ValueEnum`][crate::ValueEnum]
229231
//! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`

0 commit comments

Comments
 (0)