Version parameter
This commit is contained in:
parent
ff1c848c58
commit
7724c742ad
7
main.go
7
main.go
@ -32,6 +32,7 @@ var (
|
|||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
flagConfigFile string
|
flagConfigFile string
|
||||||
flagDev bool
|
flagDev bool
|
||||||
|
flagVersion bool
|
||||||
service *ws.Service
|
service *ws.Service
|
||||||
logFile *os.File
|
logFile *os.File
|
||||||
parsedTemplates map[string]*template.Template
|
parsedTemplates map[string]*template.Template
|
||||||
@ -59,6 +60,7 @@ func init() { // {{{
|
|||||||
cfgPath := path.Join(confDir, "smon.yaml")
|
cfgPath := path.Join(confDir, "smon.yaml")
|
||||||
flag.StringVar(&flagConfigFile, "config", cfgPath, "Path and filename of the YAML configuration file")
|
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(&flagDev, "dev", false, "reload templates on each request")
|
||||||
|
flag.BoolVar(&flagVersion, "version", false, "Display version and exit")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
componentFilenames, err = getComponentFilenames(viewFS)
|
componentFilenames, err = getComponentFilenames(viewFS)
|
||||||
@ -70,6 +72,11 @@ func init() { // {{{
|
|||||||
} // }}}
|
} // }}}
|
||||||
|
|
||||||
func main() { // {{{
|
func main() { // {{{
|
||||||
|
if flagVersion {
|
||||||
|
fmt.Println(VERSION)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
werr.Init()
|
werr.Init()
|
||||||
|
Loading…
Reference in New Issue
Block a user