docs(parser): Fix ArgMatches::value_source documentation

This commit is contained in:
Ed Page 2022-02-15 11:23:40 -06:00
parent b171802265
commit 15c7abb196

View file

@ -626,10 +626,7 @@ impl ArgMatches {
self.args.contains_key(&id) self.args.contains_key(&id)
} }
/// Check if an argument was present at runtime. /// Report where argument value came from
///
/// *NOTE:* This will always return `true` if [`default_value`] has been set.
/// [`occurrences_of`] can be used to check if a value is present at runtime.
/// ///
/// # Panics /// # Panics
/// ///
@ -638,7 +635,7 @@ impl ArgMatches {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg, ValueSource};
/// let m = Command::new("myprog") /// let m = Command::new("myprog")
/// .arg(Arg::new("debug") /// .arg(Arg::new("debug")
/// .short('d')) /// .short('d'))
@ -646,7 +643,7 @@ impl ArgMatches {
/// "myprog", "-d" /// "myprog", "-d"
/// ]); /// ]);
/// ///
/// assert!(m.is_present("debug")); /// assert_eq!(m.value_source("debug"), Some(ValueSource::CommandLine));
/// ``` /// ```
/// ///
/// [`default_value`]: crate::Arg::default_value() /// [`default_value`]: crate::Arg::default_value()