Merge pull request #5200 from epage/group

docs(ref): Be clear about implicit ArgGroup behavior
This commit is contained in:
Ed Page 2023-11-07 14:12:11 -06:00 committed by GitHub
commit b055d3d4c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 8 deletions

View file

@ -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)`].
///

View file

@ -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.

View file

@ -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
///

View file

@ -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`].
///
/// ```

View file

@ -109,7 +109,7 @@ pub fn longs_and_visible_aliases(p: &Command) -> Vec<String> {
.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<Arg> {
debug!("flags: name={}", p.get_name());

View file

@ -203,6 +203,10 @@
//! - `skip [= <expr>]`: Ignore this field, filling in with `<expr>`
//! - Without `<expr>`: 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].