rustdoc: Parse command line opts

This commit is contained in:
Brian Anderson 2012-02-28 21:31:55 -08:00
parent 6c9527ab79
commit 58e2083c0a
1 changed files with 9 additions and 7 deletions

View File

@ -93,20 +93,22 @@ fn test_run_passes() {
}
}
fn main(argv: [str]) {
fn main(args: [str]) {
if vec::contains(argv, "-h") {
if vec::contains(args, "-h") {
config::usage();
ret;
}
if vec::len(argv) != 2u {
std::io::println(#fmt("usage: %s <input>", argv[0]));
let config = alt config::parse_config(args) {
result::ok(config) { config }
result::err(err) {
std::io::println(#fmt("error: %s", err));
ret;
}
}
};
let source_file = argv[1];
run(source_file);
run(config.input_crate);
}
fn time<T>(what: str, f: fn() -> T) -> T {