From bc280293e5dc4882d571b48812a7e14251a1eeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=BAeen?= <3han5chou7@gmail.com> Date: Sat, 1 Jan 2022 16:53:10 +0900 Subject: [PATCH] add an option to show the version --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index 92fee96..eebc2d4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ fn main() { opts.optmulti("", "ignore", "Exclude a device name or path", "NAME"); opts.optflag("", "watch", "Add new devices automatically"); opts.optflag("h", "help", "print this help menu"); + opts.optflag("", "version", "show version"); let args = match opts.parse(&argv[1..]) { Ok(args) => args, @@ -38,6 +39,10 @@ fn main() { println!("{}", &usage(&program, opts)); return; } + if args.opt_present("version") { + println!("xremap version {}", env!("CARGO_PKG_VERSION")); + return; + } let filename = match &args.free.iter().map(String::as_str).collect::>()[..] { &[filename] => filename,