mirror of
https://github.com/clap-rs/clap
synced 2024-12-12 13:52:34 +00:00
docs: Clarify intention for new APIs
This commit is contained in:
parent
1c3159700d
commit
2d352cb16f
1 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue