Skip to content

Commit

Permalink
Update example in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
j-tai committed Nov 27, 2019
1 parent 0c26a0e commit 86e6069
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct MyArgsStruct<'a> {
attack_mode: bool,
em_dashes: bool,
execute: &'a str,
set_version: u32,
positional_args: &'a [String],
}

Expand All @@ -27,7 +28,9 @@ fn parse_args<'a>(opts: &'a Options<'a, String>) -> Result<MyArgsStruct<'a>> {
Opt::Short('\u{2014}') => res.em_dashes = true,
// -e EXPRESSION, or -eEXPRESSION, or
// --execute EXPRESSION, or --execute=EXPRESSION
Opt::Short('e') | Opt::Long("execute") => res.execute = opts.value()?,
Opt::Short('e') | Opt::Long("execute") => res.execute = opts.value_str()?,
// Automatically parses the value as a u32
Opt::Short('V') => res.set_version = opts.value()?,
// An unknown option was passed
opt => return Err(Error::UnknownOpt(opt)),
}
Expand Down

0 comments on commit 86e6069

Please sign in to comment.