add version info flag

This commit is contained in:
Johann150 2021-02-27 20:46:08 +01:00
parent b7ffece867
commit e00f8e5026
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1

View file

@ -129,6 +129,7 @@ fn args() -> Result<Args> {
);
opts.optflag("s", "silent", "Disable logging output");
opts.optflag("h", "help", "Print this help menu and exit.");
opts.optflag("V", "version", "Print version information and exit.");
opts.optflag(
"3",
"only-tls13",
@ -151,6 +152,10 @@ fn args() -> Result<Args> {
eprintln!("{}", opts.usage(&format!("Usage: {} [options]", &args[0])));
std::process::exit(0);
}
if matches.opt_present("V") {
eprintln!("agate {}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
let mut hostnames = vec![];
for s in matches.opt_strs("hostname") {
hostnames.push(Host::parse(&s)?);