aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2018-10-26 03:46:58 +0200
committerTeddy Wing2018-10-26 03:46:58 +0200
commitd5e89508c97eda58e76766c4dbaa605905727268 (patch)
tree4bed7683344159eee728a20a7e1534fe4acded17 /src
parent88d3f71dc79ebd5fc6b21999240935930da84273 (diff)
downloaddome-key-map-d5e89508c97eda58e76766c4dbaa605905727268.tar.bz2
config: Add `--version` flag
Should print the version of the program. Doesn't actually do any printing in Rust, because the Rust library's version number is different from the DomeKey program version. We just indicate to the Objective-C code that it should print the version number.
Diffstat (limited to 'src')
-rw-r--r--src/config.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index b4cab10..6b9d673 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -16,6 +16,7 @@ type Milliseconds = u16;
pub struct Args {
pub reload: bool,
pub daemon: bool,
+ pub version: bool,
pub license: *mut c_char,
}
@@ -24,6 +25,7 @@ impl Default for Args {
Args {
reload: false,
daemon: false,
+ version: false,
license: ptr::null_mut(),
}
}
@@ -63,6 +65,7 @@ pub fn parse_args<'a>(args: &[String], config: &'a mut Config) -> &'a mut Config
"register the software using a license plist file",
"FILE"
);
+ opts.optflag("v", "version", "print the program version");
opts.optflag("h", "help", "print this help menu");
let matches = match opts.parse(&args[1..]) {
@@ -84,6 +87,8 @@ pub fn parse_args<'a>(args: &[String], config: &'a mut Config) -> &'a mut Config
Ok(str) => config.args.license = str.into_raw(),
Err(e) => dkeprintln!("{}", e),
}
+ } else if matches.opt_present("v") {
+ config.args.version = true;
} else {
print_usage(opts);
}