mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-08 16:07:43 +00:00
rustpkg: Implement --version command-line option
Now, rustpkg --version does something useful!
This commit is contained in:
parent
ce27752a69
commit
f3d017cbab
@ -473,7 +473,8 @@ pub fn main() {
|
|||||||
pub fn main_args(args: &[~str]) {
|
pub fn main_args(args: &[~str]) {
|
||||||
let opts = ~[getopts::optflag("h"), getopts::optflag("help"),
|
let opts = ~[getopts::optflag("h"), getopts::optflag("help"),
|
||||||
getopts::optflag("j"), getopts::optflag("json"),
|
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) {
|
let matches = &match getopts::getopts(args, opts) {
|
||||||
result::Ok(m) => m,
|
result::Ok(m) => m,
|
||||||
result::Err(f) => {
|
result::Err(f) => {
|
||||||
@ -486,6 +487,13 @@ pub fn main_args(args: &[~str]) {
|
|||||||
getopts::opt_present(matches, "help");
|
getopts::opt_present(matches, "help");
|
||||||
let json = getopts::opt_present(matches, "j") ||
|
let json = getopts::opt_present(matches, "j") ||
|
||||||
getopts::opt_present(matches, "json");
|
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();
|
let mut args = matches.free.clone();
|
||||||
|
|
||||||
args.shift();
|
args.shift();
|
||||||
|
Loading…
Reference in New Issue
Block a user