Skip to content

Commit

Permalink
Re-implement --help in rustpkg
Browse files Browse the repository at this point in the history
Fixes #11423
  • Loading branch information
eminence committed Jan 11, 2014
1 parent f411b94 commit 565de31
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/librustpkg/parse_args.rs
Expand Up @@ -36,7 +36,8 @@ pub struct ParseResult {
/// Parses command line arguments of rustpkg.
/// Returns a triplet (command, remaining_args, context)
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"),
// n.b. Ignores different --pretty options for now
getopts::optflag("pretty"),
Expand Down Expand Up @@ -71,6 +72,12 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
let pretty = matches.opt_present("pretty");
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") ||
matches.opt_present("version") {
version(args[0]);
Expand Down

5 comments on commit 565de31

@bors
Copy link
Contributor

@bors bors commented on 565de31 Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at eminence@565de31

@bors
Copy link
Contributor

@bors bors commented on 565de31 Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging eminence/rust/fix_rustpkg_help = 565de31 into auto

@bors
Copy link
Contributor

@bors bors commented on 565de31 Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eminence/rust/fix_rustpkg_help = 565de31 merged ok, testing candidate = e57424b

@bors
Copy link
Contributor

@bors bors commented on 565de31 Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 565de31 Jan 11, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e57424b

Please sign in to comment.