mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
add version flag
This commit is contained in:
parent
4664d0d8a3
commit
6989297a66
2 changed files with 9 additions and 2 deletions
|
@ -27,7 +27,7 @@ func main() {
|
||||||
//defer profile.Start(profile.MemProfile, profile.MemProfileRate(1)).Stop()
|
//defer profile.Start(profile.MemProfile, profile.MemProfileRate(1)).Stop()
|
||||||
|
|
||||||
c := steward.NewConfiguration()
|
c := steward.NewConfiguration()
|
||||||
err := c.CheckFlags()
|
err := c.CheckFlags(version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("%v\n", err)
|
log.Printf("%v\n", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -597,7 +597,7 @@ func checkConfigValues(cf ConfigurationFromFile) Configuration {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckFlags will parse all flags
|
// CheckFlags will parse all flags
|
||||||
func (c *Configuration) CheckFlags() error {
|
func (c *Configuration) CheckFlags(version string) error {
|
||||||
|
|
||||||
// Create an empty default config
|
// Create an empty default config
|
||||||
var fc Configuration
|
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")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *ver {
|
||||||
|
fmt.Printf("version %v\n", version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
// Check that mandatory flag values have been set.
|
// Check that mandatory flag values have been set.
|
||||||
switch {
|
switch {
|
||||||
case c.NodeName == "":
|
case c.NodeName == "":
|
||||||
|
|
Loading…
Reference in a new issue