Skip to content

Commit 565de31

Browse files
committed
Re-implement --help in rustpkg
Fixes #11423
1 parent f411b94 commit 565de31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/librustpkg/parse_args.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ pub struct ParseResult {
3636
/// Parses command line arguments of rustpkg.
3737
/// Returns a triplet (command, remaining_args, context)
3838
pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
39-
let opts = ~[ getopts::optflag("no-link"),
39+
let opts = ~[ getopts::optflag("h"), getopts::optflag("help"),
40+
getopts::optflag("no-link"),
4041
getopts::optflag("no-trans"),
4142
// n.b. Ignores different --pretty options for now
4243
getopts::optflag("pretty"),
@@ -71,6 +72,12 @@ pub fn parse_args(args: &[~str]) -> Result<ParseResult, int> {
7172
let pretty = matches.opt_present("pretty");
7273
let emit_llvm = matches.opt_present("emit-llvm");
7374

75+
if matches.opt_present("h") ||
76+
matches.opt_present("help") {
77+
usage::general();
78+
return Err(0);
79+
}
80+
7481
if matches.opt_present("v") ||
7582
matches.opt_present("version") {
7683
version(args[0]);

0 commit comments

Comments
 (0)