Turned extra::getopts functions into methods

Some minor api and doc adjustments
This commit is contained in:
Marvin Löbel
2013-09-18 03:42:23 +02:00
parent 3c0013134c
commit 06d1dccf95
10 changed files with 668 additions and 647 deletions

View File

@@ -41,7 +41,6 @@ pub fn main() {
}
pub fn main_args(args: &[~str]) {
use extra::getopts::*;
use extra::getopts::groups::*;
let opts = ~[
@@ -56,20 +55,20 @@ pub fn main_args(args: &[~str]) {
let matches = getopts(args.tail(), opts).unwrap();
if opt_present(&matches, "h") || opt_present(&matches, "help") {
if matches.opt_present("h") || matches.opt_present("help") {
println(usage(args[0], opts));
return;
}
let libs = Cell::new(opt_strs(&matches, "L").map(|s| Path(*s)));
let libs = Cell::new(matches.opt_strs("L").map(|s| Path(*s)));
let mut passes = if opt_present(&matches, "n") {
let mut passes = if matches.opt_present("n") {
~[]
} else {
~[~"collapse-docs", ~"clean-comments", ~"collapse-privacy" ]
};
opt_strs(&matches, "a").map(|x| passes.push(x.clone()));
matches.opt_strs("a").map(|x| passes.push(x.clone()));
if matches.free.len() != 1 {
println(usage(args[0], opts));
@@ -99,7 +98,7 @@ pub fn main_args(args: &[~str]) {
})
}
for pname in opt_strs(&matches, "p").move_iter() {
for pname in matches.opt_strs("p").move_iter() {
pm.load_plugin(pname);
}