@@ -293,7 +293,39 @@ impl ArgMatches {
293
293
Some ( v)
294
294
}
295
295
296
- /// Placeholder documentation.
296
+ /// Get an [`Iterator`] over groups of values of a specific option.
297
+ ///
298
+ /// specifically grouped by the occurrences of the options.
299
+ ///
300
+ /// Each group is a `Vec<&str>` containing the arguments passed to a single occurrence
301
+ /// of the option.
302
+ ///
303
+ /// If the option doesn't support multiple occurrences, or there was only a single occurrence,
304
+ /// the iterator will only contain a single item.
305
+ ///
306
+ /// Returns `None` if the option wasn't present.
307
+ ///
308
+ /// # Panics
309
+ ///
310
+ /// If the value is invalid UTF-8.
311
+ ///
312
+ /// If `id` is not a valid argument or group name.
313
+ ///
314
+ /// # Examples
315
+ /// ```rust
316
+ /// # use clap::{Command,Arg};
317
+ /// let m = Command::new("myprog")
318
+ /// .arg(Arg::new("exec")
319
+ /// .short('x')
320
+ /// .min_values(1)
321
+ /// .multiple_occurrences(true)
322
+ /// .value_terminator(";"))
323
+ /// .get_matches_from(vec![
324
+ /// "myprog", "-x", "echo", "hi", ";", "-x", "echo", "bye"]);
325
+ /// let vals: Vec<Vec<&str>> = m.grouped_values_of("exec").unwrap().collect();
326
+ /// assert_eq!(vals, [["echo", "hi"], ["echo", "bye"]]);
327
+ /// ```
328
+ /// [`Iterator`]: std::iter::Iterator
297
329
#[ cfg( feature = "unstable-grouped" ) ]
298
330
#[ cfg_attr( debug_assertions, track_caller) ]
299
331
pub fn grouped_values_of < T : Key > ( & self , id : T ) -> Option < GroupedValues > {
0 commit comments