From 01699e3c9339cd7880f632be088d770225b84d68 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 30 Apr 2024 20:52:41 +0200 Subject: Add --version flag This allows to identify the version of a Ceres executable build. --- main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 1071aef..2c39239 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,8 @@ package main import ( "context" "embed" + "flag" + "fmt" "log" "net/http" "os" @@ -17,7 +19,15 @@ import ( ) func main() { - parseFlags() + flag.Parse() + + if printVersion { + if gitDescribe == "" { + log.Fatal("This build has no version information") + } + fmt.Println(gitDescribe) + os.Exit(0) + } model.InitStorage() defer model.RemoveStorage() -- cgit v1.2.3-70-g09d2