From 28425e484fa858f15bbe957027bb2442d46696e3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 7 Nov 2023 13:44:41 -0600 Subject: [PATCH 1/2] style(docs): Resolve warnings --- clap_builder/src/builder/arg.rs | 4 ++-- clap_builder/src/builder/command.rs | 2 +- clap_builder/src/parser/matches/arg_matches.rs | 4 ++-- clap_complete/src/generator/mod.rs | 4 ++-- clap_complete/src/generator/utils.rs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clap_builder/src/builder/arg.rs b/clap_builder/src/builder/arg.rs index 8e247c17..f83b4642 100644 --- a/clap_builder/src/builder/arg.rs +++ b/clap_builder/src/builder/arg.rs @@ -875,7 +875,7 @@ impl Arg { impl Arg { /// Specify how to react to an argument when parsing it. /// - /// [ArgAction][crate::ArgAction] controls things like + /// [ArgAction] controls things like /// - Overwriting previous values with new ones /// - Appending new values to all previous ones /// - Counting how many times a flag occurs @@ -1260,7 +1260,7 @@ impl Arg { /// Provide the shell a hint about how to complete this argument. /// - /// See [`ValueHint`][crate::ValueHint] for more information. + /// See [`ValueHint`] for more information. /// /// **NOTE:** implicitly sets [`Arg::action(ArgAction::Set)`]. /// diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index edcbace7..0f3668e5 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -1070,7 +1070,7 @@ impl Command { /// Replace prior occurrences of arguments rather than error /// /// For any argument that would conflict with itself by default (e.g. - /// [`ArgAction::Set`][ArgAction::Set], it will now override itself. + /// [`ArgAction::Set`], it will now override itself. /// /// This is the equivalent to saying the `foo` arg using [`Arg::overrides_with("foo")`] for all /// defined arguments. diff --git a/clap_builder/src/parser/matches/arg_matches.rs b/clap_builder/src/parser/matches/arg_matches.rs index 8390b0b5..e80c39b4 100644 --- a/clap_builder/src/parser/matches/arg_matches.rs +++ b/clap_builder/src/parser/matches/arg_matches.rs @@ -514,7 +514,7 @@ impl ArgMatches { MatchesError::unwrap(id, self.try_contains_id(id)) } - /// Iterate over [`Arg`][crate::Arg] and [`ArgGroup`][crate::ArgGroup] [`Id`][crate::Id]s via [`ArgMatches::ids`]. + /// Iterate over [`Arg`][crate::Arg] and [`ArgGroup`][crate::ArgGroup] [`Id`]s via [`ArgMatches::ids`]. /// /// # Examples /// @@ -1325,7 +1325,7 @@ pub(crate) struct SubCommand { pub(crate) matches: ArgMatches, } -/// Iterate over [`Arg`][crate::Arg] and [`ArgGroup`][crate::ArgGroup] [`Id`][crate::Id]s via [`ArgMatches::ids`]. +/// Iterate over [`Arg`][crate::Arg] and [`ArgGroup`][crate::ArgGroup] [`Id`]s via [`ArgMatches::ids`]. /// /// # Examples /// diff --git a/clap_complete/src/generator/mod.rs b/clap_complete/src/generator/mod.rs index a371f68a..415913e5 100644 --- a/clap_complete/src/generator/mod.rs +++ b/clap_complete/src/generator/mod.rs @@ -36,7 +36,7 @@ pub trait Generator { /// ``` fn file_name(&self, name: &str) -> String; - /// Generates output out of [`clap::Command`](Command). + /// Generates output out of [`clap::Command`]. /// /// # Panics /// @@ -44,7 +44,7 @@ pub trait Generator { /// /// # Examples /// - /// The following example generator displays the [`clap::Command`](Command) + /// The following example generator displays the [`clap::Command`] /// as if it is printed using [`std::println`]. /// /// ``` diff --git a/clap_complete/src/generator/utils.rs b/clap_complete/src/generator/utils.rs index ca76d189..6ea10d2a 100644 --- a/clap_complete/src/generator/utils.rs +++ b/clap_complete/src/generator/utils.rs @@ -109,7 +109,7 @@ pub fn longs_and_visible_aliases(p: &Command) -> Vec { .collect() } -/// Gets all the flags of a [`clap::Command`](Command). +/// Gets all the flags of a [`clap::Command`]. /// Includes `help` and `version` depending on the [`clap::Command`] settings. pub fn flags(p: &Command) -> Vec { debug!("flags: name={}", p.get_name()); From dbd013eab1e5ea8842afbaabcbd4873c174a1c5d Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 7 Nov 2023 13:47:05 -0600 Subject: [PATCH 2/2] docs(ref): Be clear about implicit ArgGroup behavior --- src/_derive/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/_derive/mod.rs b/src/_derive/mod.rs index 0c479a23..0e9e18d9 100644 --- a/src/_derive/mod.rs +++ b/src/_derive/mod.rs @@ -203,6 +203,10 @@ //! - `skip [= ]`: Ignore this field, filling in with `` //! - Without ``: fills the field with `Default::default()` //! +//! Note: +//! - For `struct`s, [`multiple = true`][crate::ArgGroup::multiple] is implied +//! - `enum` support is tracked at [#2621](https://github.com/clap-rs/clap/issues/2621) +//! //! ### Arg Attributes //! //! These correspond to a [`Arg`][crate::Arg].