Skip to content

Commit

Permalink
docs(Values): improves the docs example of the Values iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Mar 3, 2018
1 parent 1e67be4 commit 74075d6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/args/arg_matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 74075d6

Please sign in to comment.