From e323b15eb7849649b5c9bd8b4a086ee665b86dbd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 16 Feb 2024 01:18:58 -0600 Subject: [PATCH] moving code into repostatus --- main.go | 4 ++-- repolist.go | 35 ++++++++++++++++++++--------------- scan.go | 16 ++++++++-------- structs.go | 4 ++-- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/main.go b/main.go index e63d43d..7386456 100644 --- a/main.go +++ b/main.go @@ -62,8 +62,8 @@ func main() { if i < 60 { i = 60 } - // print every 13 seconds - if i%13 == 0 { + // print every 27 seconds + if i%27 == 0 { log.Info("Not auto scanning", i) } return diff --git a/repolist.go b/repolist.go index bf27bb5..54ae60e 100644 --- a/repolist.go +++ b/repolist.go @@ -17,9 +17,11 @@ func (r *repo) String() string { return r.status.String() } +/* func (r *repo) getPath() string { return r.path } +*/ func RemoveFirstElement(slice []string) (string, []string) { if len(slice) == 0 { @@ -92,24 +94,27 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri log.Info("addRepo() already had path", path) return } - log.Info("addRepo() attempting to add path", path) + // log.Info("addRepo() attempting to add path", path) newRepo := new(repo) - path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user + path = strings.TrimSuffix(path, "/") // trim any extranous '/' chars put in the config file by the user if path == "" { - log.Warn("addRepo() got empty path", path, master, devel, user) + // just an empty line in the config file return } - if repostatus.VerifyLocalGoRepo(path) { - log.Verbose("newRepo actually exists", newRepo.getPath()) + if strings.HasPrefix(path, "/") { + // this is a direct path. don't check if it is a golang repo } else { - log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user) - return + if repostatus.VerifyLocalGoRepo(path) { + // log.Verbose("newRepo actually exists", ) + } else { + // log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user) + return + } } - newRepo.path = path newRepo.pLabel = grid.NewLabel(path).SetProgName("path") newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag") @@ -157,7 +162,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri me.reposwin.Enable() }) - newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path) + newRepo.status = repostatus.NewRepoStatusWindow(path) newRepo.hidden = false newRepo.status.SetMainWorkingName(master) newRepo.status.SetDevelWorkingName(devel) @@ -166,12 +171,12 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri var showBuildB bool = false switch newRepo.status.RepoType() { case "binary": - log.Info("compile here. Show()") + // log.Info("compile here. Show()") showBuildB = true case "library": - log.Info("library here. Hide()") + // log.Info("library here. Hide()") default: - log.Info("unknown. Show()") + log.Info("unknown RepoType", newRepo.status.RepoType()) } if showBuildB { newRepo.endBox.NewButton("build", func() { @@ -250,13 +255,13 @@ func showApps() { for _, repo := range me.allrepos { switch repo.status.RepoType() { case "binary": - log.Info("compile here. Show()") + //log.Info("compile here. Show()") repo.Show() case "library": - log.Info("library here. Hide()") + //log.Info("library here. Hide()") repo.Hide() default: - log.Info("unknown. Show()") + log.Info("showApps() unknown. Show()") repo.Hide() } diff --git a/scan.go b/scan.go index f4ceb3a..0f98690 100644 --- a/scan.go +++ b/scan.go @@ -6,8 +6,6 @@ import ( "time" "go.wit.com/log" - - "go.wit.com/lib/gui/repostatus" ) func (r *repo) newScan() bool { @@ -16,12 +14,14 @@ func (r *repo) newScan() bool { return false } // r.scan() - if repostatus.VerifyLocalGoRepo(r.getPath()) { - log.Verbose("repo actually exists", r.getPath()) - } else { - log.Warn("repo does not exist", r.getPath()) - return false - } + /* + if repostatus.VerifyLocalGoRepo(r.getPath()) { + log.Verbose("repo actually exists", r.getPath()) + } else { + log.Warn("repo does not exist", r.getPath()) + return false + } + */ mname := r.status.GetMasterBranchName() mver := r.status.GetMasterVersion() mver = mver + " (" + mname + ")" diff --git a/structs.go b/structs.go index a699810..495d81c 100644 --- a/structs.go +++ b/structs.go @@ -85,8 +85,8 @@ type autoType struct { } type repo struct { - hidden bool - path string + hidden bool + // path string lasttagrev string lasttag string giturl string