diff --git a/cmd/steward/main.go b/cmd/steward/main.go index 50fcf39..74f71a4 100644 --- a/cmd/steward/main.go +++ b/cmd/steward/main.go @@ -27,7 +27,7 @@ func main() { //defer profile.Start(profile.MemProfile, profile.MemProfileRate(1)).Stop() c := steward.NewConfiguration() - err := c.CheckFlags() + err := c.CheckFlags(version) if err != nil { log.Printf("%v\n", err) return diff --git a/configuration_flags.go b/configuration_flags.go index 0beabde..41ee0c3 100644 --- a/configuration_flags.go +++ b/configuration_flags.go @@ -597,7 +597,7 @@ func checkConfigValues(cf ConfigurationFromFile) Configuration { } // CheckFlags will parse all flags -func (c *Configuration) CheckFlags() error { +func (c *Configuration) CheckFlags(version string) error { // Create an empty default config var fc Configuration @@ -691,8 +691,15 @@ func (c *Configuration) CheckFlags() error { purgeBufferDB := flag.Bool("purgeBufferDB", false, "true/false, purge the incoming buffer db and all it's state") + ver := flag.Bool("version", false, "print version and exit") + flag.Parse() + if *ver { + fmt.Printf("version %v\n", version) + os.Exit(0) + } + // Check that mandatory flag values have been set. switch { case c.NodeName == "":