diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-08-26 15:34:34 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-08-26 15:34:34 -0700 |
| commit | f3d017cbab8ebdcb08d30be36601910824ea416f (patch) | |
| tree | e379166000591a36522d361ee673602fdbcefd33 /src | |
| parent | ce27752a69df6093ec0d104a7ecce755983a0f78 (diff) | |
| download | rust-f3d017cbab8ebdcb08d30be36601910824ea416f.tar.gz rust-f3d017cbab8ebdcb08d30be36601910824ea416f.zip | |
rustpkg: Implement --version command-line option
Now, rustpkg --version does something useful!
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustpkg/rustpkg.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustpkg/rustpkg.rs b/src/librustpkg/rustpkg.rs index f5dc17851e5..6aee954801d 100644 --- a/src/librustpkg/rustpkg.rs +++ b/src/librustpkg/rustpkg.rs @@ -473,7 +473,8 @@ pub fn main() { pub fn main_args(args: &[~str]) { let opts = ~[getopts::optflag("h"), getopts::optflag("help"), getopts::optflag("j"), getopts::optflag("json"), - getopts::optmulti("c"), getopts::optmulti("cfg")]; + getopts::optmulti("c"), getopts::optmulti("cfg"), + getopts::optflag("v"), getopts::optflag("version")]; let matches = &match getopts::getopts(args, opts) { result::Ok(m) => m, result::Err(f) => { @@ -486,6 +487,13 @@ pub fn main_args(args: &[~str]) { getopts::opt_present(matches, "help"); let json = getopts::opt_present(matches, "j") || getopts::opt_present(matches, "json"); + + if getopts::opt_present(matches, "v") || + getopts::opt_present(matches, "version") { + rustc::version(args[0]); + return; + } + let mut args = matches.free.clone(); args.shift(); |
