summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-09 05:41:01 -0500
committerJeff Carr <[email protected]>2025-09-09 05:41:01 -0500
commita29a774aa43ca332cac6ca3da7242eb31a9bfcf0 (patch)
treef5b705ad4a8079a124c70f9c593ab9aaa0c215b6
parentd00e96e35405f168791c4b19f0271a0db5b2b0d2 (diff)
something, something, GUI codebasev0.0.68
-rw-r--r--argv.go6
-rw-r--r--doGui.go24
-rw-r--r--main.go36
-rw-r--r--structs.go3
4 files changed, 17 insertions, 52 deletions
diff --git a/argv.go b/argv.go
index 70e8a6a..b1f2a56 100644
--- a/argv.go
+++ b/argv.go
@@ -79,8 +79,8 @@ func (args) doBashHelp() {
}
}
-func (args) doBashAuto() {
- switch argv.BashAuto[0] {
+func (args) DoAutoComplete(argv []string) {
+ switch argv[0] {
case "list":
fmt.Println("")
case "verify":
@@ -88,7 +88,7 @@ func (args) doBashAuto() {
case "upgrade":
fmt.Println("")
default:
- if argv.BashAuto[0] == ARGNAME {
+ if argv[0] == ARGNAME {
// list the subcommands here
fmt.Println("help list")
}
diff --git a/doGui.go b/doGui.go
index 8ccb412..8945721 100644
--- a/doGui.go
+++ b/doGui.go
@@ -7,10 +7,7 @@ package main
import (
"os"
- "time"
- "go.wit.com/gui"
- "go.wit.com/lib/fhelp"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
@@ -38,21 +35,6 @@ func refresh() {
}
func doGui() {
- me.myGui = gui.New()
- me.myGui.SetAppDefaultPlugin("gocui") // sets the default GUI plugin to use
- if pname, err := me.myGui.Default(); err != nil {
- if !fhelp.BuildPlugin("gocui") {
- log.Info("You can't run the forge GUI since the plugins did not build", pname)
- okExit("")
- } else {
- if err := me.myGui.LoadToolkitNew("gocui"); err != nil {
- log.Info("The plugins built, but still failed to load", pname)
- badExit(err)
- }
- log.Info("The plugins built and loaded!", pname)
- }
- }
-
win := gadgets.RawBasicWindow("Zookeeper: (inventory your cluster)")
win.Make()
win.Show()
@@ -84,12 +66,6 @@ func doGui() {
grid.NewButton("ConfigSave()", func() {
saveMachineState()
})
-
- // sit here forever refreshing the GUI
- for {
- refresh()
- time.Sleep(90 * time.Second)
- }
}
func saveMachineState() {
diff --git a/main.go b/main.go
index 143045f..41525c3 100644
--- a/main.go
+++ b/main.go
@@ -8,8 +8,7 @@ import (
"time"
"go.wit.com/dev/alexflint/arg"
- "go.wit.com/gui"
- "go.wit.com/lib/fhelp"
+ "go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
)
@@ -21,29 +20,10 @@ var ARGNAME string = "zookeeper"
func main() {
me = new(mainType)
- gui.InitArg()
+ prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv)
+ me.myGui = prep.Gui() // prepares the GUI package for go-args
me.pp = arg.MustParse(&argv)
- if argv.Bash {
- fhelp.DoBash(ARGNAME)
- os.Exit(0)
- }
- if len(argv.BashAuto) != 0 {
- argv.doBashAuto()
- os.Exit(0)
- }
-
- // check if the binary is being called to test
- // if the plugin can actually loaded. This is a hack
- // around needing a Test() plugin load function in GO
- if gui.IsGoPluginTestHack() {
- argv.NoPort = true
- gui.CheckPlugin()
- os.Exit(0)
- // if argv.GuiCheck != "" {
- // }
- }
-
if argv.Daemon {
// turn off timestamps for STDOUT (systemd adds them)
log.DaemonMode(true)
@@ -65,5 +45,13 @@ func main() {
if !argv.NoPort {
go startHTTP()
}
- doGui()
+
+ me.myGui.Start() // loads the GUI toolkit
+ doGui() // start making our forge GUI
+
+ // sit here forever refreshing the GUI
+ for {
+ refresh()
+ time.Sleep(90 * time.Second)
+ }
}
diff --git a/structs.go b/structs.go
index 8a70611..fa740e5 100644
--- a/structs.go
+++ b/structs.go
@@ -9,6 +9,7 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
+ "go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/zoopb"
)
@@ -26,7 +27,7 @@ type mainType struct {
machines *zoopb.Machines // every machine that has reported itself to the zookeeper
targets map[string]string // what versions the machines should be running
upgrade map[string]bool // use this to trigger builds
- myGui *gui.Node // the gui toolkit handle
+ myGui *prep.GuiPrep // the gui toolkit handle
machinesWin *gadgets.GenericWindow // the machines gui window
machinesBox *gui.Node // the machines gui parent box widget
machinesTB *zoopb.MachinesTable // the machines gui table buffer