Skip to content

Commit 58e2083

Browse files
committed
rustdoc: Parse command line opts
1 parent 6c9527a commit 58e2083

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/rustdoc/rustdoc.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,22 @@ fn test_run_passes() {
9393
}
9494
}
9595

96-
fn main(argv: [str]) {
96+
fn main(args: [str]) {
9797

98-
if vec::contains(argv, "-h") {
98+
if vec::contains(args, "-h") {
9999
config::usage();
100100
ret;
101101
}
102102

103-
if vec::len(argv) != 2u {
104-
std::io::println(#fmt("usage: %s <input>", argv[0]));
103+
let config = alt config::parse_config(args) {
104+
result::ok(config) { config }
105+
result::err(err) {
106+
std::io::println(#fmt("error: %s", err));
105107
ret;
106-
}
108+
}
109+
};
107110

108-
let source_file = argv[1];
109-
run(source_file);
111+
run(config.input_crate);
110112
}
111113

112114
fn time<T>(what: str, f: fn() -> T) -> T {

0 commit comments

Comments
 (0)