scan for all versions
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
96379b6279
commit
25c783fab5
63
main.go
63
main.go
|
@ -14,6 +14,20 @@ import (
|
||||||
|
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
|
||||||
|
var allrepos []*repo
|
||||||
|
|
||||||
|
type repo struct {
|
||||||
|
path string
|
||||||
|
|
||||||
|
pLabel *gui.Node // path label
|
||||||
|
bLabel *gui.Node // branch label
|
||||||
|
vLabel *gui.Node // version label
|
||||||
|
sLabel *gui.Node // git state (dirty or not?)
|
||||||
|
|
||||||
|
cButton *gui.Node // commit button
|
||||||
|
pButton *gui.Node // push button
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
myGui = gui.New().Default()
|
myGui = gui.New().Default()
|
||||||
|
|
||||||
|
@ -23,28 +37,41 @@ func main() {
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
||||||
func addRepo(grid *gui.Node, path string) {
|
func (r *repo) scan() {
|
||||||
grid.NewLabel(path)
|
log.Info("r.path", r.path)
|
||||||
ver := grid.NewLabel("VERSION")
|
b, out := run(r.path, "git", "describe --tags")
|
||||||
b, out := run(path, "git", "describe --tags")
|
|
||||||
if b {
|
if b {
|
||||||
ver.SetText(out)
|
r.vLabel.SetText(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// cmd := "dig +noall +answer www.wit.com A"
|
// cmd := "dig +noall +answer www.wit.com A"
|
||||||
// out = shell.Run(cmd)
|
// out = shell.Run(cmd)
|
||||||
grid.NewLabel("jcarr")
|
}
|
||||||
grid.NewLabel("dirty")
|
|
||||||
|
|
||||||
grid.NewButton("commit", func () {
|
func checkrepos() {
|
||||||
log.Println("world")
|
for i, r := range allrepos {
|
||||||
hellosmart()
|
r.scan()
|
||||||
})
|
log.Info("scanned them all", i)
|
||||||
grid.NewButton("push", func () {
|
}
|
||||||
log.Println("world")
|
}
|
||||||
hellosmart()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
func addRepo(grid *gui.Node, path string) *repo {
|
||||||
|
newRepo := new(repo)
|
||||||
|
|
||||||
|
newRepo.path = path
|
||||||
|
newRepo.pLabel = grid.NewLabel(path)
|
||||||
|
newRepo.vLabel = grid.NewLabel("VER")
|
||||||
|
newRepo.bLabel = grid.NewLabel("jcarr")
|
||||||
|
newRepo.sLabel = grid.NewLabel("dirty")
|
||||||
|
|
||||||
|
newRepo.cButton = grid.NewButton("commit", func () {
|
||||||
|
log.Println("commit")
|
||||||
|
})
|
||||||
|
newRepo.cButton = grid.NewButton("push", func () {
|
||||||
|
log.Println("push")
|
||||||
|
})
|
||||||
|
allrepos = append(allrepos, newRepo)
|
||||||
|
return newRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
|
@ -62,7 +89,8 @@ func helloworld() {
|
||||||
grid.NewLabel("commit")
|
grid.NewLabel("commit")
|
||||||
grid.NewLabel("push to")
|
grid.NewLabel("push to")
|
||||||
|
|
||||||
addRepo(grid, "go.wit.com/log")
|
newr := addRepo(grid, "go.wit.com/log")
|
||||||
|
newr.scan()
|
||||||
addRepo(grid, "go.wit.com/arg")
|
addRepo(grid, "go.wit.com/arg")
|
||||||
addRepo(grid, "go.wit.com/spew")
|
addRepo(grid, "go.wit.com/spew")
|
||||||
addRepo(grid, "go.wit.com/shell")
|
addRepo(grid, "go.wit.com/shell")
|
||||||
|
@ -70,6 +98,9 @@ func helloworld() {
|
||||||
addRepo(grid, "go.wit.com/gui/gadgets")
|
addRepo(grid, "go.wit.com/gui/gadgets")
|
||||||
addRepo(grid, "go.wit.com/gui/gadgets")
|
addRepo(grid, "go.wit.com/gui/gadgets")
|
||||||
|
|
||||||
|
box.NewButton("checkrepos()", func () {
|
||||||
|
checkrepos()
|
||||||
|
})
|
||||||
box.NewButton("hello", func () {
|
box.NewButton("hello", func () {
|
||||||
log.Println("world")
|
log.Println("world")
|
||||||
hellosmart()
|
hellosmart()
|
||||||
|
|
Loading…
Reference in New Issue