Skip to content

Commit f3d017c

Browse files
committed
rustpkg: Implement --version command-line option
Now, rustpkg --version does something useful!
1 parent ce27752 commit f3d017c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustpkg/rustpkg.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ pub fn main() {
473473
pub fn main_args(args: &[~str]) {
474474
let opts = ~[getopts::optflag("h"), getopts::optflag("help"),
475475
getopts::optflag("j"), getopts::optflag("json"),
476-
getopts::optmulti("c"), getopts::optmulti("cfg")];
476+
getopts::optmulti("c"), getopts::optmulti("cfg"),
477+
getopts::optflag("v"), getopts::optflag("version")];
477478
let matches = &match getopts::getopts(args, opts) {
478479
result::Ok(m) => m,
479480
result::Err(f) => {
@@ -486,6 +487,13 @@ pub fn main_args(args: &[~str]) {
486487
getopts::opt_present(matches, "help");
487488
let json = getopts::opt_present(matches, "j") ||
488489
getopts::opt_present(matches, "json");
490+
491+
if getopts::opt_present(matches, "v") ||
492+
getopts::opt_present(matches, "version") {
493+
rustc::version(args[0]);
494+
return;
495+
}
496+
489497
let mut args = matches.free.clone();
490498

491499
args.shift();

0 commit comments

Comments
 (0)