diff --git a/clap_builder/src/builder/arg.rs b/clap_builder/src/builder/arg.rs index e3d0d7d0ef7..79181497652 100644 --- a/clap_builder/src/builder/arg.rs +++ b/clap_builder/src/builder/arg.rs @@ -98,6 +98,10 @@ impl Arg { /// The name is used to check whether or not the argument was used at /// runtime, get values, set relationships with other args, etc.. /// + /// By default, an `Arg` is + /// - Positional, see [`Arg::short`] or [`Arg::long`] turn it into an option + /// - Accept a single value, see [`Arg::action`] to override this + /// ///
/// /// **NOTE:** In the case of arguments that take values (i.e. [`Arg::action(ArgAction::Set)`]) diff --git a/src/_derive/_tutorial/chapter_2.rs b/src/_derive/_tutorial/chapter_2.rs index 4178f579790..4b56782de1d 100644 --- a/src/_derive/_tutorial/chapter_2.rs +++ b/src/_derive/_tutorial/chapter_2.rs @@ -10,7 +10,7 @@ //! //! ### Positionals //! -//! You can have users specify values by their position on the command-line: +//! By default, struct fields define positional arguments: //! //! ```rust #![doc = include_str!("../../../examples/tutorial_derive/03_03_positional.rs")] diff --git a/src/_derive/mod.rs b/src/_derive/mod.rs index a1a1d671f44..09b7f052a20 100644 --- a/src/_derive/mod.rs +++ b/src/_derive/mod.rs @@ -220,6 +220,9 @@ //! ### Arg Attributes //! //! These correspond to a [`Arg`][crate::Arg]. +//! The default state for a field without attributes is to be a positional argument with [behavior +//! inferred from the field type](#arg-types). +//! `#[arg(...)]` attributes allow overriding or extending those defaults. //! //! **Raw attributes:** Any [`Arg` method][crate::Arg] can also be used as an attribute, see [Terminology](#terminology) for syntax. //! - e.g. `#[arg(num_args(..=3))]` would translate to `arg.num_args(..=3)` diff --git a/src/_tutorial/chapter_2.rs b/src/_tutorial/chapter_2.rs index 607b4e4e68c..09abf95a781 100644 --- a/src/_tutorial/chapter_2.rs +++ b/src/_tutorial/chapter_2.rs @@ -9,7 +9,7 @@ //! //! ### Positionals //! -//! You can have users specify values by their position on the command-line: +//! By default, an [`Arg`] defines a positional argument: //! //! ```rust #![doc = include_str!("../../examples/tutorial_builder/03_03_positional.rs")]