scan for all versions

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-09 02:22:01 -06:00
parent 96379b6279
commit 25c783fab5
1 changed files with 47 additions and 16 deletions

63
main.go
View File

@ -14,6 +14,20 @@ import (
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() {
myGui = gui.New().Default()
@ -23,28 +37,41 @@ func main() {
gui.Watchdog()
}
func addRepo(grid *gui.Node, path string) {
grid.NewLabel(path)
ver := grid.NewLabel("VERSION")
b, out := run(path, "git", "describe --tags")
func (r *repo) scan() {
log.Info("r.path", r.path)
b, out := run(r.path, "git", "describe --tags")
if b {
ver.SetText(out)
r.vLabel.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()
})
func checkrepos() {
for i, r := range allrepos {
r.scan()
log.Info("scanned them all", i)
}
}
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
@ -62,7 +89,8 @@ func helloworld() {
grid.NewLabel("commit")
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/spew")
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")
box.NewButton("checkrepos()", func () {
checkrepos()
})
box.NewButton("hello", func () {
log.Println("world")
hellosmart()