docs: Clarify intention for new APIs

This commit is contained in:
Ed Page 2022-08-08 08:44:36 -05:00
parent 1c3159700d
commit 2d352cb16f

View file

@ -778,7 +778,14 @@ impl<'help> Arg<'help> {
/// # Value Handling
impl<'help> Arg<'help> {
/// Specify the behavior when parsing an argument
/// Specify how to react to an argument when parsing it.
///
/// [ArgAction][crate::ArgAction] controls things like
/// - Overwriting previous values with new ones
/// - Appending new values to all previous ones
/// - Counting how many times a flag occurs
///
/// The default action is `ArgAction::Set`
///
/// # Examples
///
@ -789,7 +796,7 @@ impl<'help> Arg<'help> {
/// .arg(
/// Arg::new("flag")
/// .long("flag")
/// .action(clap::ArgAction::Set)
/// .action(clap::ArgAction::Append)
/// );
///
/// let matches = cmd.try_get_matches_from(["mycmd", "--flag", "value"]).unwrap();
@ -811,6 +818,8 @@ impl<'help> Arg<'help> {
/// This allows parsing and validating a value before storing it into
/// [`ArgMatches`][crate::ArgMatches].
///
/// The default value is [`ValueParser::string`][crate::builder::ValueParser::string].
///
/// See also
/// - [`value_parser!`][crate::value_parser!] for auto-selecting a value parser for a given type
/// - [`BoolishValueParser`][crate::builder::BoolishValueParser], and [`FalseyValueParser`][crate::builder::FalseyValueParser] for alternative `bool` implementations