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!("");