diff --git a/globalBuildOptions.go b/globalBuildOptions.go index b9da67c..ccf6b0b 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -29,9 +29,12 @@ func quickCmd(fullpath string, cmd []string) bool { if me.autoWorkingPwd.String() != fullpath { me.autoWorkingPwd.SetValue(fullpath) } - log.Warn("RUN:", fullpath, cmd) + if me.autoDryRun.Checked() { + log.Warn("RUN --dry-run", fullpath, cmd) return false + } else { + log.Warn("RUN:", fullpath, cmd) } err, b, output = repostatus.RunCmd(fullpath, cmd) diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 33fc4a5..dca42a8 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -9,6 +9,37 @@ import ( // "go.wit.com/gui/gadgets" ) +func globalDisplayHide() { + for _, repo := range me.allrepos { + if me.autoHideReadOnly.Checked() { + if repo.status.ReadOnly() { + repo.Hide() + } + } + if me.autoHidePerfect.Checked() { + if repo.dirtyLabel.String() == "PERFECT" { + repo.Hide() + } + } + } +} + +func globalDisplayShow() { + for _, repo := range me.allrepos { + if me.autoHideReadOnly.Checked() { + if repo.status.ReadOnly() { + continue + } + } + if me.autoHidePerfect.Checked() { + if repo.dirtyLabel.String() == "PERFECT" { + continue + } + } + repo.Show() + } +} + func globalDisplayOptions(box *gui.Node) { vbox := box.NewVerticalBox("DISPLAYVBOX") @@ -47,26 +78,18 @@ func globalDisplayOptions(box *gui.Node) { me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true) me.autoHideReadOnly.Custom = func() { if me.autoHideReadOnly.Checked() { - for _, repo := range me.allrepos { - if repo.status.ReadOnly() { - repo.Hide() - } - } + globalDisplayHide() + } else { + globalDisplayShow() } } me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false) me.autoHidePerfect.Custom = func() { if me.autoHidePerfect.Checked() { - for _, repo := range me.allrepos { - if repo.dirtyLabel.String() == "PERFECT" { - repo.Hide() - } - } + globalDisplayHide() } else { - for _, repo := range me.allrepos { - repo.Show() - } + globalDisplayShow() } } diff --git a/globalTestingOptions.go b/globalTestingOptions.go index cd183bc..3db2727 100644 --- a/globalTestingOptions.go +++ b/globalTestingOptions.go @@ -55,7 +55,7 @@ func globalTestingOptions(box *gui.Node) { me.downloadEverythingButton.Enable() } }) - test1.NewButton("build all apps", func() { + test1.NewButton("go.wit.com/list", func() { listWindow() }) test1.NewButton("repostatus.ListAll()", func() { diff --git a/listWindow.go b/listWindow.go index 5bcb9d7..3f87050 100644 --- a/listWindow.go +++ b/listWindow.go @@ -4,6 +4,7 @@ package main import ( "io/ioutil" "net/http" + "os" "strings" "go.wit.com/gui" @@ -15,13 +16,20 @@ import ( var lw *gadgets.BasicWindow var allsections []*section +type witRepo struct { + sec *section + path *gui.Node + downloadB *gui.Node +} + type section struct { name string parent *gui.Node box *gui.Node group *gui.Node - checkbox *gui.Node - repos []*gui.Node + grid *gui.Node // where the repos are listed + hideCB *gui.Node + witRepos []*witRepo } func listWindow() { @@ -66,8 +74,19 @@ func (s *section) add(path string) { if s == nil { return } - tmp := s.parent.NewLabel(path) - s.repos = append(s.repos, tmp) + tmp := new(witRepo) + tmp.sec = s + tmp.path = s.grid.NewLabel(path) + tmp.downloadB = s.grid.NewButton("download", func() { + lw.Disable() + log.Info("downloading", tmp.path.String(), "here") + os.Setenv("GO111MODULE", "off") + fullpath := "/home/jcarr/go/src/go.wit.com/" + quickCmd(fullpath, []string{"go", "get", "-v", tmp.path.String()}) + lw.Enable() + }) + + s.witRepos = append(s.witRepos, tmp) } func NewSection(parent *gui.Node, path string) *section { @@ -75,19 +94,21 @@ func NewSection(parent *gui.Node, path string) *section { news.parent = parent news.box = news.parent.NewBox("bw vbox", true) news.group = news.box.NewGroup(path) - news.checkbox = news.box.NewCheckbox("hide") - news.checkbox.Custom = func() { + news.hideCB = news.box.NewCheckbox("hide") + news.hideCB.Custom = func() { news.toggle() } + news.grid = news.parent.NewGrid("sections", 2, 1) allsections = append(allsections, news) return news } func (s *section) toggle() { log.Warn(s.name) - for i, n := range s.repos { - log.Warn(i, n.String()) - n.Hide() + for i, wrepo := range s.witRepos { + log.Warn(i, wrepo.path.String()) + wrepo.path.Hide() + wrepo.downloadB.Hide() } } diff --git a/structs.go b/structs.go index 1b5e467..d795e04 100644 --- a/structs.go +++ b/structs.go @@ -22,8 +22,8 @@ type autoType struct { autotypistWindow *gadgets.BasicWindow // #### autotypist Global Display Options - autoHidePerfect *gui.Node - autoHideReadOnly *gui.Node + autoHidePerfect *gui.Node + autoHideReadOnly *gui.Node // #### autotypist Global Build Options // what to change all the branches to