Skip to content

Commit

Permalink
Merge pull request #5200 from epage/group
Browse files Browse the repository at this point in the history
docs(ref): Be clear about implicit ArgGroup behavior
  • Loading branch information
epage authored Nov 7, 2023
2 parents 14fd853 + dbd013e commit b055d3d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions clap_builder/src/builder/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)`].
///
Expand Down
2 changes: 1 addition & 1 deletion clap_builder/src/builder/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions clap_builder/src/parser/matches/arg_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down Expand Up @@ -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
///
Expand Down
4 changes: 2 additions & 2 deletions clap_complete/src/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ pub trait Generator {
/// ```
fn file_name(&self, name: &str) -> String;

/// Generates output out of [`clap::Command`](Command).
/// Generates output out of [`clap::Command`].
///
/// # Panics
///
/// May panic when called outside of the context of [`generate`] or [`generate_to`]
///
/// # 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`].
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/src/generator/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions src/_derive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down

0 comments on commit b055d3d

Please sign in to comment.