From 07a60ffe3cefab8345c3750cdb8449886cf05342 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 14 Feb 2024 00:19:36 -0600 Subject: [PATCH] code reorg Signed-off-by: Jeff Carr --- branchesBox.go | 26 ++++++++++---------------- commandsBox.go => modifyBox.go | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 17 deletions(-) rename commandsBox.go => modifyBox.go (88%) diff --git a/branchesBox.go b/branchesBox.go index 38c1d26..f692d2e 100644 --- a/branchesBox.go +++ b/branchesBox.go @@ -7,22 +7,29 @@ import ( func (rs *RepoStatus) makeBranchesBox() { rs.gitBranchesGroup = rs.window.Box().NewGroup("branches") - newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 2, 2) + newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 0, 0) rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag") + newgrid.NextRow() rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master") + newgrid.NextRow() rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel") + newgrid.NextRow() rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user") + newgrid.NextRow() rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch") + newgrid.NextRow() rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version") + newgrid.NextRow() rs.showBranchesButton = newgrid.NewButton("getBranches()", func() { all := rs.getBranches() i := len(all) log.Log(WARN, "branch count =", i) }) + newgrid.NextRow() rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() { if rs.CheckBranches() { @@ -31,6 +38,7 @@ func (rs *RepoStatus) makeBranchesBox() { log.Log(WARN, "Branches are not perfect") } }) + newgrid.NextRow() newgrid.NewButton("show .git/config", func() { if rs.gitConfig == nil { @@ -47,6 +55,7 @@ func (rs *RepoStatus) makeBranchesBox() { log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge) } }) + newgrid.NextRow() newgrid.NewButton("CheckDirty()", func() { if rs.CheckDirty() { @@ -55,19 +64,4 @@ func (rs *RepoStatus) makeBranchesBox() { log.Log(WARN, "is not dirty") } }) - - // rs.TagsW = rs.TagWindow() - - newgrid.NewButton("Show tags", func() { - if rs.TagsW == nil { - log.Warn("error: found rs.TagsW == nil") - rs.TagsW = rs.TagWindow() - return - } - if rs.TagsW.Hidden() { - rs.TagsW.Show() - } else { - rs.TagsW.Show() - } - }) } diff --git a/commandsBox.go b/modifyBox.go similarity index 88% rename from commandsBox.go rename to modifyBox.go index 865e4b0..098dbe0 100644 --- a/commandsBox.go +++ b/modifyBox.go @@ -6,12 +6,25 @@ import ( ) func (rs *RepoStatus) drawGitCommands() { - rs.gitCommandsGroup = rs.window.Box().NewGroup("git commands") + rs.gitCommandsGroup = rs.window.Box().NewGroup("modify") newgrid := rs.gitCommandsGroup.NewGrid("gridnuts", 0, 0) newgrid.NewButton("update", func() { rs.Update() }) + + newgrid.NewButton("Show tags", func() { + if rs.TagsW == nil { + log.Warn("error: found rs.TagsW == nil") + rs.TagsW = rs.TagWindow() + return + } + if rs.TagsW.Hidden() { + rs.TagsW.Show() + } else { + rs.TagsW.Show() + } + }) newgrid.NextRow() newgrid.NewButton("git pull", func() {