code reorg

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-14 00:19:36 -06:00
parent f7947b08b6
commit 07a60ffe3c
2 changed files with 24 additions and 17 deletions

View File

@ -7,22 +7,29 @@ import (
func (rs *RepoStatus) makeBranchesBox() { func (rs *RepoStatus) makeBranchesBox() {
rs.gitBranchesGroup = rs.window.Box().NewGroup("branches") 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") rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag")
newgrid.NextRow()
rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master") rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master")
newgrid.NextRow()
rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel") rs.develBranchVersion = gadgets.NewOneLiner(newgrid, "devel")
newgrid.NextRow()
rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user") rs.userBranchVersion = gadgets.NewOneLiner(newgrid, "user")
newgrid.NextRow()
rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch") rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch")
newgrid.NextRow()
rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version") rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version")
newgrid.NextRow()
rs.showBranchesButton = newgrid.NewButton("getBranches()", func() { rs.showBranchesButton = newgrid.NewButton("getBranches()", func() {
all := rs.getBranches() all := rs.getBranches()
i := len(all) i := len(all)
log.Log(WARN, "branch count =", i) log.Log(WARN, "branch count =", i)
}) })
newgrid.NextRow()
rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() { rs.checkBranchesButton = newgrid.NewButton("CheckBranches()", func() {
if rs.CheckBranches() { if rs.CheckBranches() {
@ -31,6 +38,7 @@ func (rs *RepoStatus) makeBranchesBox() {
log.Log(WARN, "Branches are not perfect") log.Log(WARN, "Branches are not perfect")
} }
}) })
newgrid.NextRow()
newgrid.NewButton("show .git/config", func() { newgrid.NewButton("show .git/config", func() {
if rs.gitConfig == nil { if rs.gitConfig == nil {
@ -47,6 +55,7 @@ func (rs *RepoStatus) makeBranchesBox() {
log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge) log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
} }
}) })
newgrid.NextRow()
newgrid.NewButton("CheckDirty()", func() { newgrid.NewButton("CheckDirty()", func() {
if rs.CheckDirty() { if rs.CheckDirty() {
@ -55,19 +64,4 @@ func (rs *RepoStatus) makeBranchesBox() {
log.Log(WARN, "is not dirty") 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()
}
})
} }

View File

@ -6,12 +6,25 @@ import (
) )
func (rs *RepoStatus) drawGitCommands() { 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 := rs.gitCommandsGroup.NewGrid("gridnuts", 0, 0)
newgrid.NewButton("update", func() { newgrid.NewButton("update", func() {
rs.Update() 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.NextRow()
newgrid.NewButton("git pull", func() { newgrid.NewButton("git pull", func() {