getopts: replaced base functions with those from group
This commit is contained in:
parent
9752c63035
commit
c09ca940e5
8 changed files with 467 additions and 509 deletions
|
@ -29,7 +29,6 @@ use std::str;
|
|||
use extra::json;
|
||||
use serialize::{Decodable, Encodable};
|
||||
use extra::time;
|
||||
use getopts::groups;
|
||||
|
||||
pub mod clean;
|
||||
pub mod core;
|
||||
|
@ -80,8 +79,8 @@ pub fn main() {
|
|||
std::os::set_exit_status(main_args(std::os::args()));
|
||||
}
|
||||
|
||||
pub fn opts() -> ~[groups::OptGroup] {
|
||||
use getopts::groups::*;
|
||||
pub fn opts() -> ~[getopts::OptGroup] {
|
||||
use getopts::*;
|
||||
~[
|
||||
optflag("h", "help", "show this help message"),
|
||||
optflag("", "version", "print rustdoc's version"),
|
||||
|
@ -107,11 +106,11 @@ pub fn opts() -> ~[groups::OptGroup] {
|
|||
}
|
||||
|
||||
pub fn usage(argv0: &str) {
|
||||
println!("{}", groups::usage(format!("{} [options] <input>", argv0), opts()));
|
||||
println!("{}", getopts::usage(format!("{} [options] <input>", argv0), opts()));
|
||||
}
|
||||
|
||||
pub fn main_args(args: &[~str]) -> int {
|
||||
let matches = match groups::getopts(args.tail(), opts()) {
|
||||
let matches = match getopts::getopts(args.tail(), opts()) {
|
||||
Ok(m) => m,
|
||||
Err(err) => {
|
||||
println!("{}", err.to_err_msg());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue