From 15c7abb1965c1f3841c79f425e53fbc37b1bbf5f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 15 Feb 2022 11:23:40 -0600 Subject: [PATCH] docs(parser): Fix ArgMatches::value_source documentation --- src/parse/matches/arg_matches.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/parse/matches/arg_matches.rs b/src/parse/matches/arg_matches.rs index 3815f8e1..ab854f60 100644 --- a/src/parse/matches/arg_matches.rs +++ b/src/parse/matches/arg_matches.rs @@ -626,10 +626,7 @@ impl ArgMatches { self.args.contains_key(&id) } - /// Check if an argument was present at runtime. - /// - /// *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. + /// Report where argument value came from /// /// # Panics /// @@ -638,7 +635,7 @@ impl ArgMatches { /// # Examples /// /// ```rust - /// # use clap::{Command, Arg}; + /// # use clap::{Command, Arg, ValueSource}; /// let m = Command::new("myprog") /// .arg(Arg::new("debug") /// .short('d')) @@ -646,7 +643,7 @@ impl ArgMatches { /// "myprog", "-d" /// ]); /// - /// assert!(m.is_present("debug")); + /// assert_eq!(m.value_source("debug"), Some(ValueSource::CommandLine)); /// ``` /// /// [`default_value`]: crate::Arg::default_value()