Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/librustc/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,17 @@ fn run_compiler(args: &[~str]) {
driver::compile_input(sess, cfg, &input, &odir, &ofile);
}

pub fn version(argv0: &str) {
pub fn version(command: &str) {
let vers = match option_env!("CFG_VERSION") {
Some(vers) => vers,
None => "unknown version"
};
println!("{} {}", argv0, vers);
println!("{} {}", command, vers);
println!("host: {}", driver::host_triple());
}

fn usage(argv0: &str) {
let message = format!("Usage: {} [OPTIONS] INPUT", argv0);
fn usage() {
let message = format!("Usage: rustc [OPTIONS] INPUT");
println!("{}\n\
Additional help:
-C help Print codegen options
Expand Down Expand Up @@ -192,9 +192,10 @@ fn describe_codegen_flags() {
/// should continue, returns a getopts::Matches object parsed from args, otherwise
/// returns None.
pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
let binary = args.shift().unwrap();
// Throw away the first argument, the name of the binary
let _binary = args.shift().unwrap();

if args.is_empty() { usage(binary); return None; }
if args.is_empty() { usage(); return None; }

let matches =
match getopts::getopts(args.as_slice(), config::optgroups().as_slice()) {
Expand All @@ -205,7 +206,7 @@ pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
};

if matches.opt_present("h") || matches.opt_present("help") {
usage(binary);
usage();
return None;
}

Expand Down Expand Up @@ -234,7 +235,7 @@ pub fn handle_options(mut args: Vec<~str>) -> Option<getopts::Matches> {
}

if matches.opt_present("v") || matches.opt_present("version") {
version(binary);
version("rustc");
return None;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn main_args(args: &[StrBuf]) -> int {
usage(args[0].as_slice());
return 0;
} else if matches.opt_present("version") {
rustc::driver::version(args[0].as_slice());
rustc::driver::version("rustdoc");
return 0;
}

Expand Down