1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

comm: add --version

This commit is contained in:
Michael Gehring 2014-05-18 13:09:46 +02:00
parent d34d85ae37
commit c841b518d1

View file

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