From c841b518d1b773c4c3dfa78f21b50651b78f7b00 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 18 May 2014 13:09:46 +0200 Subject: [PATCH] comm: add --version --- comm/comm.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comm/comm.rs b/comm/comm.rs index 8e4bfcdab..7a9ad0063 100644 --- a/comm/comm.rs +++ b/comm/comm.rs @@ -88,6 +88,7 @@ pub fn main() { getopts::optflag("2", "", "suppress column 2 (lines uniq to FILE2)"), getopts::optflag("3", "", "suppress column 3 (lines that appear in both files)"), getopts::optflag("h", "help", "display this help and exit"), + getopts::optflag("V", "version", "output version information and exit"), ]; let matches = match getopts::getopts(args.tail(), opts) { @@ -95,6 +96,11 @@ pub fn main() { Err(err) => fail!("{}", err.to_err_msg()), }; + if matches.opt_present("version") { + println!("{} {}", NAME, VERSION); + return; + } + if matches.opt_present("help") || matches.free.len() != 2 { println!("{} {}", NAME, VERSION); println!("");