summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/main.go b/main.go
index 8b9f823..353791b 100644
--- a/main.go
+++ b/main.go
@@ -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