summaryrefslogtreecommitdiff
path: root/branchesBox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-14 00:09:58 -0600
committerJeff Carr <[email protected]>2024-02-14 00:09:58 -0600
commitf7947b08b69b1a2f02168de511e7c8b005035221 (patch)
treeadae2c1f5b0bc546a078e1311b3e18b0a0636578 /branchesBox.go
parent95fd6ca05a28774ad374801984a4f62c202835d3 (diff)
code reorg and clean
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'branchesBox.go')
-rw-r--r--branchesBox.go73
1 files changed, 73 insertions, 0 deletions
diff --git a/branchesBox.go b/branchesBox.go
new file mode 100644
index 0000000..38c1d26
--- /dev/null
+++ b/branchesBox.go
@@ -0,0 +1,73 @@
+package repostatus
+
+import (
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/log"
+)
+
+func (rs *RepoStatus) makeBranchesBox() {
+ rs.gitBranchesGroup = rs.window.Box().NewGroup("branches")
+ newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 2, 2)
+
+ rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag")
+
+ rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master")
+ rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel")
+ rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user")
+
+ rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch")
+ rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version")
+
+ rs.showBranchesButton = newgrid.NewButton("getBranches()", func() {
+ all := rs.getBranches()
+ i := len(all)
+ log.Log(WARN, "branch count =", i)
+ })
+
+ rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() {
+ if rs.CheckBranches() {
+ log.Log(WARN, "Branches are perfect")
+ } else {
+ log.Log(WARN, "Branches are not perfect")
+ }
+ })
+
+ newgrid.NewButton("show .git/config", func() {
+ if rs.gitConfig == nil {
+ log.Log(WARN, "Nonexistant or damaged .git/config", rs.String())
+ return
+ }
+ log.Log(WARN, ".git/config:", rs.realPath.String())
+
+ // The info:
+ for name, remote := range rs.gitConfig.remotes {
+ log.Log(WARN, " ", name, "url:", remote.url)
+ }
+ for name, branch := range rs.gitConfig.branches {
+ log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
+ }
+ })
+
+ newgrid.NewButton("CheckDirty()", func() {
+ if rs.CheckDirty() {
+ log.Log(WARN, "is dirty")
+ } else {
+ 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()
+ }
+ })
+}