54 lines
945 B
Go
54 lines
945 B
Go
package repolist
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
func (r *RepoList) SetAutoScan(b bool) {
|
|
me.autoScan = b
|
|
}
|
|
|
|
func (r *RepoList) ScanRepositories() (int, string) {
|
|
var i int
|
|
t := TimeFunction(func() {
|
|
for _, repo := range me.allrepos {
|
|
i += 1
|
|
repo.NewScan()
|
|
}
|
|
})
|
|
s := fmt.Sprint(t)
|
|
log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
|
|
return i, s
|
|
}
|
|
|
|
func (r *Repo) NewScan() bool {
|
|
if r.Status == nil {
|
|
log.Warn("repo.Status = nil. not initialized for some reason")
|
|
return false
|
|
}
|
|
|
|
// run the repostatus update
|
|
r.Status.UpdateNew()
|
|
|
|
// print out whatever changes have happened
|
|
if c, ok := r.Status.Changed(); ok {
|
|
c := strings.TrimSpace(c)
|
|
for _, line := range strings.Split(c, "\n") {
|
|
log.Info(r.Status.Path(), line)
|
|
}
|
|
}
|
|
|
|
// hide or show repos based on the checkboxes
|
|
if me.autoHidePerfect {
|
|
if r.IsPerfect() {
|
|
r.Hide()
|
|
} else {
|
|
r.Show()
|
|
}
|
|
}
|
|
return true
|
|
}
|