auto merge of #11466 : eminence/rust/fix_rustpkg_help, r=brson

It appears --help got lost in aa50ebd03e

Fixes #11423
This commit is contained in:
bors 2014-01-11 01:21:49 -08:00
commit e57424b5cc
1 changed files with 8 additions and 1 deletions

View File

@ -36,7 +36,8 @@ pub struct ParseResult {
/// Parses command line arguments of rustpkg. /// Parses command line arguments of rustpkg.
/// Returns a triplet (command, remaining_args, context) /// Returns a triplet (command, remaining_args, context)
pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> { pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
let opts = ~[ getopts::optflag("no-link"), let opts = ~[ getopts::optflag("h"), getopts::optflag("help"),
getopts::optflag("no-link"),
getopts::optflag("no-trans"), getopts::optflag("no-trans"),
// n.b. Ignores different --pretty options for now // n.b. Ignores different --pretty options for now
getopts::optflag("pretty"), getopts::optflag("pretty"),
@ -71,6 +72,12 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
let pretty = matches.opt_present("pretty"); let pretty = matches.opt_present("pretty");
let emit_llvm = matches.opt_present("emit-llvm"); let emit_llvm = matches.opt_present("emit-llvm");
if matches.opt_present("h") ||
matches.opt_present("help") {
usage::general();
return Err(0);
}
if matches.opt_present("v") || if matches.opt_present("v") ||
matches.opt_present("version") { matches.opt_present("version") {
version(args[0]); version(args[0]);