From 7724c742ad8dfc1f80d41df3aab70afc622164fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 13:21:22 +0200 Subject: [PATCH] Version parameter --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 5a635fe..e191dd5 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,7 @@ var ( logger *slog.Logger flagConfigFile string flagDev bool + flagVersion bool service *ws.Service logFile *os.File parsedTemplates map[string]*template.Template @@ -59,6 +60,7 @@ func init() { // {{{ cfgPath := path.Join(confDir, "smon.yaml") flag.StringVar(&flagConfigFile, "config", cfgPath, "Path and filename of the YAML configuration file") flag.BoolVar(&flagDev, "dev", false, "reload templates on each request") + flag.BoolVar(&flagVersion, "version", false, "Display version and exit") flag.Parse() componentFilenames, err = getComponentFilenames(viewFS) @@ -70,6 +72,11 @@ func init() { // {{{ } // }}} func main() { // {{{ + if flagVersion { + fmt.Println(VERSION) + os.Exit(0) + } + var err error werr.Init()