From 74075d65e8db1ddb5e2a4558009a5729d749d1b6 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 3 Mar 2018 14:29:52 -0500 Subject: [PATCH] docs(Values): improves the docs example of the Values iterator --- src/args/arg_matches.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/args/arg_matches.rs b/src/args/arg_matches.rs index 9222aeb3905..20309269a40 100644 --- a/src/args/arg_matches.rs +++ b/src/args/arg_matches.rs @@ -734,10 +734,16 @@ impl<'a> ArgMatches<'a> { /// # use clap::{App, Arg}; /// let m = App::new("myapp") /// .arg(Arg::with_name("output") +/// .short("o") +/// .multiple(true) /// .takes_value(true)) -/// .get_matches_from(vec!["myapp", "something"]); +/// .get_matches_from(vec!["myapp", "-o", "val1", "val2"]); +/// +/// let values = m.values_of("output").unwrap(); /// -/// assert_eq!(m.value_of("output"), Some("something")); +/// assert_eq!(values.next(), Some("val1")); +/// assert_eq!(values.next(), Some("val2")); +/// assert_eq!(values.next(), None); /// ``` /// [`ArgMatches::values_of`]: ./struct.ArgMatches.html#method.values_of #[derive(Clone)]