From 92e2944ca9b1f32cfe043486abc394341dcc1302 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 14 Aug 2026 23:28:17 +0100 Subject: [PATCH] Support --version --- .goreleaser.yml | 2 ++ src/main.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index b287da2..0b09cd8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,6 +5,8 @@ project_name: softnet builds: - builder: rust command: build + env: + - SOFTNET_VERSION={{ .Version }}-{{ .ShortCommit }} targets: - aarch64-apple-darwin - x86_64-apple-darwin diff --git a/src/main.rs b/src/main.rs index 9d4ce7d..a5324b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,13 @@ use system_configuration::sys::preferences::{ }; use uzers::{get_current_groupname, get_current_username, get_effective_uid}; +const VERSION: &str = match option_env!("SOFTNET_VERSION") { + Some(version) => version, + None => "unknown-unknown", +}; + #[derive(Parser, Debug)] +#[command(version = VERSION)] struct Args { #[clap( long,