diff options
| author | Jeff Carr <[email protected]> | 2025-10-04 17:37:37 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-04 17:37:37 -0500 |
| commit | 1c015f05bd0a2ab32fc83bacb75c7ad4d1415405 (patch) | |
| tree | c03868fb07d4e8f36427fbbc6a1d5110a09a9da4 /main.go | |
| parent | e21b1e4649a91585ae4435653d6607247ade88e4 (diff) | |
add autocompletev0.0.102
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 |
