aboutsummaryrefslogtreecommitdiff
path: root/server/discover
diff options
context:
space:
mode:
Diffstat (limited to 'server/discover')
-rw-r--r--server/discover/Cargo.toml1
-rw-r--r--server/discover/src/main.rs14
2 files changed, 15 insertions, 0 deletions
diff --git a/server/discover/Cargo.toml b/server/discover/Cargo.toml
index 6a1a8209..a9ffeff3 100644
--- a/server/discover/Cargo.toml
+++ b/server/discover/Cargo.toml
@@ -17,3 +17,4 @@ http-body-util = "0.1"
hyper-util = { version = "0.1", features = ["full"] }
hurrycurry-protocol = { path = "../protocol" }
serde_json = "1.0.140"
+clap = { version = "4.5.39", features = ["derive"] }
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()