getopts: fixed a failing test
This commit is contained in:
parent
2ce7019b87
commit
968ce53dff
1 changed files with 5 additions and 6 deletions
|
@ -31,7 +31,7 @@
|
||||||
//!
|
//!
|
||||||
//! ~~~{.rust}
|
//! ~~~{.rust}
|
||||||
//! extern mod getopts;
|
//! extern mod getopts;
|
||||||
//! use getopts::{optopt,optflag,getopts,Opt};
|
//! use getopts::{optopt,optflag,getopts,OptGroup};
|
||||||
//! use std::os;
|
//! use std::os;
|
||||||
//!
|
//!
|
||||||
//! fn do_work(inp: &str, out: Option<~str>) {
|
//! fn do_work(inp: &str, out: Option<~str>) {
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
//! }
|
//! }
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! fn print_usage(program: &str, _opts: &[Opt]) {
|
//! fn print_usage(program: &str, _opts: &[OptGroup]) {
|
||||||
//! println!("Usage: {} [options]", program);
|
//! println!("Usage: {} [options]", program);
|
||||||
//! println!("-o\t\tOutput");
|
//! println!("-o\t\tOutput");
|
||||||
//! println!("-h --help\tUsage");
|
//! println!("-h --help\tUsage");
|
||||||
|
@ -54,15 +54,14 @@
|
||||||
//! let program = args[0].clone();
|
//! let program = args[0].clone();
|
||||||
//!
|
//!
|
||||||
//! let opts = ~[
|
//! let opts = ~[
|
||||||
//! optopt("o"),
|
//! optopt("o", "", "set output file name", "NAME"),
|
||||||
//! optflag("h"),
|
//! optflag("h", "help", "print this help menu")
|
||||||
//! optflag("help")
|
|
||||||
//! ];
|
//! ];
|
||||||
//! let matches = match getopts(args.tail(), opts) {
|
//! let matches = match getopts(args.tail(), opts) {
|
||||||
//! Ok(m) => { m }
|
//! Ok(m) => { m }
|
||||||
//! Err(f) => { fail!(f.to_err_msg()) }
|
//! Err(f) => { fail!(f.to_err_msg()) }
|
||||||
//! };
|
//! };
|
||||||
//! if matches.opt_present("h") || matches.opt_present("help") {
|
//! if matches.opt_present("h") {
|
||||||
//! print_usage(program, opts);
|
//! print_usage(program, opts);
|
||||||
//! return;
|
//! return;
|
||||||
//! }
|
//! }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue