parent
a0be4a93d1
commit
96379b6279
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
||||||
all:
|
all:
|
||||||
go build -v -x
|
go build -v -x
|
||||||
./control-panel-vpn
|
./myrepos
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
|
|
73
main.go
73
main.go
|
@ -2,7 +2,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"strings"
|
||||||
|
"os/exec"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
"go.wit.com/apps/control-panel-dns/smartwindow"
|
"go.wit.com/apps/control-panel-dns/smartwindow"
|
||||||
|
@ -19,11 +23,54 @@ func main() {
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addRepo(grid *gui.Node, path string) {
|
||||||
|
grid.NewLabel(path)
|
||||||
|
ver := grid.NewLabel("VERSION")
|
||||||
|
b, out := run(path, "git", "describe --tags")
|
||||||
|
if b {
|
||||||
|
ver.SetText(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
// cmd := "dig +noall +answer www.wit.com A"
|
||||||
|
// out = shell.Run(cmd)
|
||||||
|
grid.NewLabel("jcarr")
|
||||||
|
grid.NewLabel("dirty")
|
||||||
|
|
||||||
|
grid.NewButton("commit", func () {
|
||||||
|
log.Println("world")
|
||||||
|
hellosmart()
|
||||||
|
})
|
||||||
|
grid.NewButton("push", func () {
|
||||||
|
log.Println("world")
|
||||||
|
hellosmart()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
func helloworld() {
|
func helloworld() {
|
||||||
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
||||||
|
|
||||||
win.Box().NewButton("hello", func () {
|
box := win.Box().NewBox("bw vbox", false)
|
||||||
|
group := box.NewGroup("test")
|
||||||
|
grid := group.NewGrid("test", 6, 1)
|
||||||
|
|
||||||
|
grid.NewLabel("Repo")
|
||||||
|
grid.NewLabel("Version")
|
||||||
|
grid.NewLabel("Current branch")
|
||||||
|
grid.NewLabel("is dirty?")
|
||||||
|
grid.NewLabel("commit")
|
||||||
|
grid.NewLabel("push to")
|
||||||
|
|
||||||
|
addRepo(grid, "go.wit.com/log")
|
||||||
|
addRepo(grid, "go.wit.com/arg")
|
||||||
|
addRepo(grid, "go.wit.com/spew")
|
||||||
|
addRepo(grid, "go.wit.com/shell")
|
||||||
|
addRepo(grid, "")
|
||||||
|
addRepo(grid, "go.wit.com/gui/gadgets")
|
||||||
|
addRepo(grid, "go.wit.com/gui/gadgets")
|
||||||
|
|
||||||
|
box.NewButton("hello", func () {
|
||||||
log.Println("world")
|
log.Println("world")
|
||||||
hellosmart()
|
hellosmart()
|
||||||
})
|
})
|
||||||
|
@ -39,7 +86,7 @@ func hellosmart() {
|
||||||
win.SetDraw(smartDraw)
|
win.SetDraw(smartDraw)
|
||||||
win.Make()
|
win.Make()
|
||||||
|
|
||||||
win.Box().NewButton("hello", func () {
|
win.Box().NewButton("test smartwindow", func () {
|
||||||
log.Println("smart")
|
log.Println("smart")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -49,3 +96,23 @@ func smartDraw(sw *smartwindow.SmartWindow) {
|
||||||
log.Println("smart")
|
log.Println("smart")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func run(path string, thing string, cmdline string) (bool, string) {
|
||||||
|
parts := strings.Split(cmdline, " ")
|
||||||
|
// Create the command
|
||||||
|
cmd := exec.Command(thing, parts...)
|
||||||
|
|
||||||
|
// Set the working directory
|
||||||
|
cmd.Dir = "/home/jcarr/go/src/" + path
|
||||||
|
|
||||||
|
// Execute the command
|
||||||
|
output, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err, "cmd error'd out", parts)
|
||||||
|
return false, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the output
|
||||||
|
log.Info(string(output))
|
||||||
|
return true, string(output)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue