From 5ba5612b2049be392c8eaaac1198e509660dae3a Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 12 Oct 2016 00:28:08 -0700 Subject: add version flags and command --- src/bin/einhyrningsinsctl.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/bin/einhyrningsinsctl.rs') 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) -- cgit v1.2.3