Version parameter

This commit is contained in:
Magnus Åhall 2024-05-20 13:21:22 +02:00
parent ff1c848c58
commit 7724c742ad

View File

@ -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()