aboutsummaryrefslogtreecommitdiff
path: root/server/discover/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-07-07 18:37:01 +0200
committermetamuffin <metamuffin@disroot.org>2025-07-07 18:37:01 +0200
commit9be9937f75c2711d5d7fd9759ed615397fff5c7f (patch)
tree35b4baaa3833ba01c7e2ec35e966f4be6dd8dab0 /server/discover/src/main.rs
parent3e6f1dd21d55e32549052e9484be3dc6b3b6cdab (diff)
downloadhurrycurry-9be9937f75c2711d5d7fd9759ed615397fff5c7f.tar
hurrycurry-9be9937f75c2711d5d7fd9759ed615397fff5c7f.tar.bz2
hurrycurry-9be9937f75c2711d5d7fd9759ed615397fff5c7f.tar.zst
Add --version option discover tool
Diffstat (limited to 'server/discover/src/main.rs')
-rw-r--r--server/discover/src/main.rs14
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()