summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-09 02:22:01 -0600
committerJeff Carr <[email protected]>2024-01-09 02:22:01 -0600
commit25c783fab563b855cd7a1218eb6751c4d2c62c49 (patch)
treef08b7037d2224856fe61fabecb5f71b5372dd2ae
parent96379b62795dfaabae415ff469942d77ea8f2817 (diff)
scan for all versions
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--main.go61
1 files changed, 46 insertions, 15 deletions
diff --git a/main.go b/main.go
index 2ce67a1..1e40608 100644
--- a/main.go
+++ b/main.go
@@ -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()
+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")
})
- grid.NewButton("push", func () {
- log.Println("world")
- hellosmart()
+ 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()