summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addRepo.go1
-rw-r--r--common.go19
-rw-r--r--scan.go23
-rw-r--r--structs.go8
-rw-r--r--viewAutotypist.go2
-rw-r--r--viewGuiReleaser.go2
6 files changed, 50 insertions, 5 deletions
diff --git a/addRepo.go b/addRepo.go
index b863323..04fd1ab 100644
--- a/addRepo.go
+++ b/addRepo.go
@@ -156,7 +156,6 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.Status.Build()
})
}
- newRepo.goState = r.blind.NewLabel("in the blind")
case "guireleaser":
newRepo.targetV = newRepo.Status.MirrorTargetVersion()
grid.Append(newRepo.targetV)
diff --git a/common.go b/common.go
index 371a47f..75427b4 100644
--- a/common.go
+++ b/common.go
@@ -2,6 +2,7 @@ package repolist
import (
"go.wit.com/lib/gui/repostatus"
+ "go.wit.com/gui"
"go.wit.com/log"
)
@@ -74,11 +75,23 @@ func (r *Repo) IsDirty() bool {
}
func (r *Repo) ReadOnly() bool {
+ if r == nil {
+ log.Warn("ReadOnly() repo == nil")
+ return false
+ }
+ if r.Status == nil {
+ log.Warn("ReadOnly() repo.Status == nil")
+ return false
+ }
return r.Status.ReadOnly()
}
func (r *Repo) LastTag() string {
- return r.Status.GetLastTagVersion()
+ if r == nil {
+ log.Warn("LastTag() repo == nil")
+ return ""
+ }
+ return r.lastTag.String()
}
// returns the state of the GO go.mod and go.sum files
@@ -139,3 +152,7 @@ func (r *Repo) DeleteTag(t *repostatus.Tag) bool {
r.Status.DeleteTag(t)
return true
}
+
+func (rl *RepoList) MirrorShownCount() *gui.Node {
+ return gui.RawMirror(rl.shownCount)
+}
diff --git a/scan.go b/scan.go
index 98ce4c9..baddf66 100644
--- a/scan.go
+++ b/scan.go
@@ -2,6 +2,7 @@ package repolist
import (
"fmt"
+ "strconv"
"strings"
"go.wit.com/log"
@@ -11,15 +12,37 @@ func (r *RepoList) SetAutoScan(b bool) {
me.autoScan = b
}
+func (r *RepoList) RegisterHideFunction(f func (* Repo)) {
+ me.hideFunction = f
+}
+
func (r *RepoList) ScanRepositories() (int, string) {
var i int
+ var shown int
t := TimeFunction(func() {
for _, repo := range me.allrepos {
i += 1
repo.NewScan()
+ if me.hideFunction == nil {
+ // application didn't register a hide function
+ } else {
+ me.hideFunction(repo)
+ }
+ }
+ var hidden int
+ for _, repo := range me.allrepos {
+ if repo.Hidden() {
+ hidden += 1
+ } else {
+ shown += 1
+ }
}
})
s := fmt.Sprint(t)
+ tmp := strconv.Itoa(shown) + " repos shown"
+ log.Info("Setting shownCount to", tmp)
+ me.shownCount.SetText(tmp)
+
log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
return i, s
}
diff --git a/structs.go b/structs.go
index d9db235..721dced 100644
--- a/structs.go
+++ b/structs.go
@@ -24,20 +24,22 @@ type RepoList struct {
allrepos map[string]*Repo
viewName string
- // reposwin *gadgets.BasicWindow
reposbox *gui.Node
reposgrid *gui.Node
reposgroup *gui.Node
// put things here that can't be seen
blind *gui.Node
+
+ shownCount *gui.Node
+ hideFunction func(*Repo)
}
type Repo struct {
hidden bool
lasttagrev string
- lasttag string
- giturl string
+ // lasttag string
+ giturl string
pLabel *gui.Node // path label
diff --git a/viewAutotypist.go b/viewAutotypist.go
index d9a8f03..54e638c 100644
--- a/viewAutotypist.go
+++ b/viewAutotypist.go
@@ -27,6 +27,8 @@ func AutotypistView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
me.reposgrid.NextRow()
+
me.blind = gui.RawBox()
+ me.shownCount = me.blind.NewLabel("showCount")
return me
}
diff --git a/viewGuiReleaser.go b/viewGuiReleaser.go
index 7b2cfbc..e75d751 100644
--- a/viewGuiReleaser.go
+++ b/viewGuiReleaser.go
@@ -26,6 +26,8 @@ func GuireleaserView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("git State")
me.reposgrid.NewLabel("GO State")
me.reposgrid.NextRow()
+
me.blind = gui.RawBox()
+ me.shownCount = me.blind.NewLabel("showCount")
return me
}