From 1a3ac687309373257d2bdf4a1119eacf00de6f67 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 22 Feb 2024 15:54:36 -0600 Subject: [PATCH] only check for build button on a go.wit.com/apps --- addRepo.go | 31 +++++++++++++++++-------------- new.go | 29 ----------------------------- 2 files changed, 17 insertions(+), 43 deletions(-) delete mode 100644 new.go diff --git a/addRepo.go b/addRepo.go index 8242ab0..0f6a2cc 100644 --- a/addRepo.go +++ b/addRepo.go @@ -2,6 +2,7 @@ package repolist import ( "errors" + "strings" "go.wit.com/gui" "go.wit.com/lib/gui/repostatus" @@ -141,20 +142,22 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str // newRepo.Status.SetDevelWorkingName(devel) // newRepo.Status.SetUserWorkingName(user) - var showBuildB bool = false - switch newRepo.Status.RepoType() { - case "binary": - // log.Info("compile here. Show()") - showBuildB = true - case "library": - // log.Info("library here. Hide()") - default: - // log.Info("unknown RepoType", newRepo.Status.RepoType()) - } - if showBuildB { - newRepo.endBox.NewButton("build", func() { - newRepo.Status.Build() - }) + if strings.HasPrefix(newRepo.GoPath(), "go.wit.com/apps") { + var showBuildB bool = false + switch newRepo.Status.RepoType() { + case "binary": + log.Info("showing compile here button") + showBuildB = true + case "library": + // log.Info("library here. Hide()") + default: + // log.Info("unknown RepoType", newRepo.Status.RepoType()) + } + if showBuildB { + newRepo.endBox.NewButton("build", func() { + newRepo.Status.Build() + }) + } } case "guireleaser": newRepo.targetV = newRepo.Status.MirrorTargetVersion() diff --git a/new.go b/new.go deleted file mode 100644 index 237f582..0000000 --- a/new.go +++ /dev/null @@ -1,29 +0,0 @@ -package repolist - -import ( - "go.wit.com/log" -) - -func RemoveFirstElement(slice []string) (string, []string) { - if len(slice) == 0 { - return "", slice // Return the original slice if it's empty - } - return slice[0], slice[1:] // Return the slice without the first element -} - -func RepoType() { - for _, repo := range me.allrepos { - switch repo.Status.RepoType() { - case "binary": - //log.Info("compile here. Show()") - repo.Show() - case "library": - //log.Info("library here. Hide()") - repo.Hide() - default: - log.Info("showApps() unknown. Show()") - repo.Hide() - } - - } -}