repostatus/modifyBox.go

111 lines
2.5 KiB
Go
Raw Normal View History

package repostatus
import (
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
func (rs *RepoStatus) drawGitCommands() {
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() {
var cmd []string
cmd = append(cmd, "git", "pull")
err, b, output := RunCmd(rs.realPath.String(), cmd)
log.Warn("Did git pull here", err, b, output)
})
newgrid.NextRow()
label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String()
rs.develMergeB = newgrid.NewButton(label, func() {
rs.Disable()
if rs.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
}
rs.Enable()
})
label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String()
rs.mainMergeB = newgrid.NewButton(label, func() {
rs.Disable()
if rs.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
}
rs.Enable()
})
newgrid.NextRow()
rs.major = gadgets.NewBasicCombobox(newgrid, "major")
rs.major.Custom = func() {
rs.setTag()
rs.generateCmd()
}
rs.major.Hide()
newgrid.NextRow()
rs.minor = gadgets.NewBasicCombobox(newgrid, "minor")
rs.minor.Custom = func() {
rs.setTag()
rs.generateCmd()
}
rs.minor.Hide()
newgrid.NextRow()
rs.revision = gadgets.NewBasicCombobox(newgrid, "revision")
rs.revision.Custom = func() {
rs.setTag()
rs.generateCmd()
}
rs.revision.Hide()
newgrid.NextRow()
// newgrid.NewLabel("new tag version")
rs.newversion = newgrid.NewLabel("0.0.1")
rs.newversion.Hide()
newgrid.NextRow()
rs.versionMessage = gadgets.NewBasicEntry(newgrid, "tag message")
rs.versionMessage.Custom = func() {
rs.generateCmd()
}
rs.versionMessage.Hide()
newgrid.NextRow()
rs.versionCmdOutput = gadgets.NewOneLiner(newgrid, "tag cmd")
rs.versionCmdOutput.Hide()
newgrid.NextRow()
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
rs.Disable()
rs.runReleaseVersionB()
})
rs.releaseVersion.Hide()
newgrid.NextRow()
newgrid.Margin()
newgrid.Pad()
}