diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-10-12 00:28:08 -0700 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-10-12 00:28:08 -0700 |
commit | 5ba5612b2049be392c8eaaac1198e509660dae3a (patch) | |
tree | c9d2afdfe60616f5e4549a63106549f11dc29a09 /src/bin | |
parent | 2dca737392a208e094b6f054f39100b8d31ed80d (diff) | |
download | einhyrningsins-5ba5612b2049be392c8eaaac1198e509660dae3a.tar.gz einhyrningsins-5ba5612b2049be392c8eaaac1198e509660dae3a.zip |
add version flags and command
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/einhyrningsinsctl.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/einhyrningsinsctl.rs b/src/bin/einhyrningsinsctl.rs index c057b9e..0e55073 100644 --- a/src/bin/einhyrningsinsctl.rs +++ b/src/bin/einhyrningsinsctl.rs @@ -108,17 +108,23 @@ fn main() { let mut opts = Options::new(); opts.optflag("h", "help", "print this help menu"); + opts.optflag("", "version", "print the version"); let matches = match opts.parse(&args[1..]) { Ok(m) => { m } Err(f) => { println!("{}", f.to_string()); print_usage(opts); exit(-1); } }; - if matches.opt_present("h") { + if matches.opt_present("help") { print_usage(opts); return; } + if matches.opt_present("version") { + println!("einhyrningsinsctl {}", env!("CARGO_PKG_VERSION")); + return; + } + // Bind to Control Socket let ctrl_path = Path::new("/tmp/einhorn.sock"); // XXX: handle this more gracefully (per-process) |