diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -9,26 +9,25 @@ import ( "os" "time" - "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/gui/prep" "go.wit.com/lib/hostname" "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) +// sent via -ldflags var VERSION string var BUILDTIME string +// used for shell auto completion +var ARGNAME string = "zood" + //go:embed resources/* var resources embed.FS func main() { me = new(zoodStruct) - me.pp = arg.MustParse(&argv) - - if me.pp == nil { - me.pp.WriteHelp(os.Stdout) - os.Exit(0) - } + me.sh = prep.Bash(&argv) // adds shell auto complete to go-args if argv.Daemon { // turn off timestamps for STDOUT (systemd adds them) @@ -36,14 +35,17 @@ func main() { me.machine, me.fullpath = zoopb.InitDaemon() } else { me.machine, me.fullpath = zoopb.InitMachine() + } + if argv.Status != nil { + log.Info("todo: show status here") + me.sh.GoodExit("says hi") } if err := testZoo(); err != nil { - log.Info("FAILED TO CONNECT TO ZOOKEEPER: ", err) - log.Info("sleeping for 3 minutes") + log.Info("failed to connect. sleeping for 3 minutes") time.Sleep(3 * time.Minute) - os.Exit(0) + me.sh.BadExit("failed to connect to zookeeper", err) } me.pollDelay = 3 * time.Second me.failcountmax = 20 // die every minute if zookeeper can't be found |
