Print usage messages to rustc and rustdoc when invoked with no args. Close #1394.
This commit is contained in:
parent
90ae3e3168
commit
bfc9a499c2
@ -61,6 +61,9 @@ options:
|
||||
|
||||
fn main(args: [str]) {
|
||||
let args = args, binary = vec::shift(args);
|
||||
|
||||
if vec::len(args) == 0u { usage(binary); ret; }
|
||||
|
||||
let match =
|
||||
alt getopts::getopts(args, opts()) {
|
||||
ok(m) { m }
|
||||
|
@ -179,9 +179,17 @@ fn doc_header(rd: rustdoc, name: str) {
|
||||
* argv[1]: crate file name",
|
||||
args(argv = "Command-line arguments.")
|
||||
)]
|
||||
|
||||
fn main(argv: [str]) {
|
||||
let sess = @{cm: codemap::new_codemap(), mutable next_id: 0};
|
||||
|
||||
let w = io::stdout();
|
||||
|
||||
if vec::len(argv) != 2u {
|
||||
w.write_str(#fmt("usage: %s <input>\n", argv[0]));
|
||||
ret;
|
||||
}
|
||||
|
||||
let sess = @{cm: codemap::new_codemap(), mutable next_id: 0};
|
||||
let rd = { ps: pprust::rust_printer(w), w: w };
|
||||
doc_header(rd, argv[1]);
|
||||
let p = parser::parse_crate_from_source_file(argv[1], [], sess);
|
||||
|
Loading…
Reference in New Issue
Block a user