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. --- flags.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'flags.go') diff --git a/flags.go b/flags.go index e7ff85e..862cffa 100644 --- a/flags.go +++ b/flags.go @@ -7,15 +7,18 @@ import ( const help = `Ceres - Recipe server for local networks -Usage: ceres [-h | --help] +Usage: ceres [-h | --help] [-v | --version] -h, --help show this help page and exit + -v, --version print version information ` -func parseFlags() { +var printVersion bool + +func init() { + flag.BoolVar(&printVersion, "version", false, "print version information") + flag.BoolVar(&printVersion, "v", false, "print version information") flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), help) } - - flag.Parse() } -- cgit v1.2.3-70-g09d2