Merge pull request #54 from KeenS/version-option

add an option to show the version
This commit is contained in:
Takashi Kokubun 2022-01-01 00:16:02 -08:00 committed by GitHub
commit 359afbe616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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::<Vec<&str>>()[..] {
&[filename] => filename,