example doesn't print args.full_usage() as expected
Opened this issue · 0 comments
tvanriper commented
Environment:
- Linux, Manjaro XFCE rolling distribution, up to date
- cargo 1.58.0-nightly (94ca096af 2021-10-29)
Steps used to reproduce:
- Browse to http://mattforni.github.io/rust/doc/args/
- Follow instructions, copying code directly from page.
- Add
getopts = "0.2"
to[dependencies]
in Cargo.toml file. - Change the various
try!()
statements to use the?
construction instead (for example,try!(args.parse(input);
becomesargs.parse(input)?;
). - Change
match parse(&vec!("-i", "5")) {
tomatch parse(&vec!("-i", "5", "--help")) {
. - Execute with
cargo run
.
Expected result
Run outputs:
Usage: program [-h] -i TIMES [-l NAME]
Run this program
Options:
-h, --help Pring the usage menu
-i, --iter TIMES The number of times to run this program
-l, --log_file NAME The name of the log file
Successfully parsed args
Actual result
Run outputs:
Successfully parsed args
Notes
I realize this is trivial, but I figure you'd probably want to know about it, just in case someone might want to start off using this code as a sort of template before launching into something more elaborate or the like.
It's a simple enough fix. I'll see if I can provide a pull request for it after I finish writing this up.