diff options
Diffstat (limited to 'server/discover/src')
-rw-r--r-- | server/discover/src/main.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/discover/src/main.rs b/server/discover/src/main.rs index f546cd6c..0ed43927 100644 --- a/server/discover/src/main.rs +++ b/server/discover/src/main.rs @@ -17,6 +17,7 @@ */ #![feature(never_type)] use anyhow::Result; +use clap::Parser; use http_body_util::Full; use hurrycurry_protocol::registry::Entry; use hyper::{ @@ -29,7 +30,20 @@ use mdns_sd::{ServiceDaemon, ServiceEvent}; use std::{cmp::Reverse, collections::HashMap, net::SocketAddr, sync::Arc}; use tokio::{net::TcpListener, spawn, sync::RwLock}; +#[derive(Parser)] +struct Args { + /// Print version and exit + #[arg(short, long)] + version: bool, +} + fn main() -> Result<()> { + let args = Args::parse(); + if args.version { + println!("{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + env_logger::init_from_env("LOG"); tokio::runtime::Builder::new_current_thread() .enable_all() |