From ab7c8717a3dc6d88bffb6faecbc583e7d628d310 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 23 Feb 2024 14:25:00 -0600 Subject: [PATCH] report count of the changes --- common.go | 2 +- scan.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/common.go b/common.go index b0f6c17..d675efd 100644 --- a/common.go +++ b/common.go @@ -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() } diff --git a/scan.go b/scan.go index f2e80ea..faf176a 100644 --- a/scan.go +++ b/scan.go @@ -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 }