Skip to content

Commit 947513c

Browse files
committed
auto merge of #8773 : catamorphism/rust/rustpkg-version-flag, r=anasazi
r? anyone. Now, rustpkg --version does something useful!
2 parents 604ab94 + f3d017c commit 947513c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustpkg/rustpkg.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ pub fn main() {
475475
pub fn main_args(args: &[~str]) {
476476
let opts = ~[getopts::optflag("h"), getopts::optflag("help"),
477477
getopts::optflag("j"), getopts::optflag("json"),
478-
getopts::optmulti("c"), getopts::optmulti("cfg")];
478+
getopts::optmulti("c"), getopts::optmulti("cfg"),
479+
getopts::optflag("v"), getopts::optflag("version")];
479480
let matches = &match getopts::getopts(args, opts) {
480481
result::Ok(m) => m,
481482
result::Err(f) => {
@@ -488,6 +489,13 @@ pub fn main_args(args: &[~str]) {
488489
getopts::opt_present(matches, "help");
489490
let json = getopts::opt_present(matches, "j") ||
490491
getopts::opt_present(matches, "json");
492+
493+
if getopts::opt_present(matches, "v") ||
494+
getopts::opt_present(matches, "version") {
495+
rustc::version(args[0]);
496+
return;
497+
}
498+
491499
let mut args = matches.free.clone();
492500

493501
args.shift();

0 commit comments

Comments
 (0)