something, something, GUI codebase
This commit is contained in:
parent
d00e96e354
commit
a29a774aa4
6
argv.go
6
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")
|
||||
}
|
||||
|
|
24
doGui.go
24
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() {
|
||||
|
|
36
main.go
36
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue