From 9754e32858688a0add4beddb2837b0ddedc4a6bf Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 25 Feb 2024 13:10:23 -0600 Subject: cleaner code. some use of ENV --- scan.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'scan.go') diff --git a/scan.go b/scan.go index 9dce2f5..811cee6 100644 --- a/scan.go +++ b/scan.go @@ -8,10 +8,6 @@ import ( "go.wit.com/log" ) -func (r *RepoList) SetAutoScan(b bool) { - me.autoScan = b -} - func (r *RepoList) RegisterHideFunction(f func(*RepoRow)) { me.hideFunction = f } @@ -25,11 +21,6 @@ func (r *RepoList) ScanRepositories() (int, string) { i += 1 changed := repo.NewScan() total += changed - if me.hideFunction == nil { - // application didn't register a hide function - } else { - me.hideFunction(repo) - } } var hidden int for _, repo := range me.allrepos { @@ -60,6 +51,14 @@ func (r *RepoRow) NewScan() int { // run the repostatus update r.Status.Update() + if me.hideFunction == nil { + // application didn't register a hide function + // always show everything in that case + r.Show() + } else { + me.hideFunction(r) + } + // print out whatever changes have happened if c, ok := r.Status.Changed(); ok { log.Log(REPOWARN, "something finally changed") @@ -70,13 +69,5 @@ func (r *RepoRow) NewScan() int { } } - // hide or show repos based on the checkboxes - if me.autoHidePerfect { - if r.IsPerfect() { - r.Hide() - } else { - r.Show() - } - } return changed } -- cgit v1.2.3