report count of the changes

This commit is contained in:
Jeff Carr 2024-02-23 14:25:00 -06:00
parent db83cb7fb9
commit ab7c8717a3
2 changed files with 10 additions and 6 deletions

View File

@ -45,7 +45,7 @@ func (r *RepoRow) State() string {
return r.gitState.String()
}
func (r *RepoRow) Scan() bool {
func (r *RepoRow) Scan() int {
return r.NewScan()
}

14
scan.go
View File

@ -19,10 +19,12 @@ func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) {
func (r *RepoList) ScanRepositories() (int, string) {
var i int
var shown int
var total int
t := TimeFunction(func() {
for _, repo := range me.allrepos {
i += 1
repo.NewScan()
changed := repo.NewScan()
total += changed
if me.hideFunction == nil {
// application didn't register a hide function
} else {
@ -44,14 +46,15 @@ func (r *RepoList) ScanRepositories() (int, string) {
me.shownCount.SetText(tmp)
me.duration.SetText(s)
log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
log.Info("Scanned", i, "repositories.", total, "changes in", s)
return i, s
}
func (r *RepoRow) NewScan() bool {
func (r *RepoRow) NewScan() int {
var changed int = 0
if r.Status == nil {
log.Warn("repo.Status = nil. not initialized for some reason")
return false
return changed
}
// run the repostatus update
@ -62,6 +65,7 @@ func (r *RepoRow) NewScan() bool {
c := strings.TrimSpace(c)
for _, line := range strings.Split(c, "\n") {
log.Info(r.Status.Path(), line)
changed += 1
}
}
@ -73,5 +77,5 @@ func (r *RepoRow) NewScan() bool {
r.Show()
}
}
return true
return changed
}