add guireleaser view
This commit is contained in:
parent
860981e63d
commit
02542bafe8
149
addRepo.go
149
addRepo.go
|
@ -75,64 +75,101 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
|
|||
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
|
||||
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
||||
newRepo.endBox.NewButton("Configure", func() {
|
||||
if newRepo.Status == nil {
|
||||
// this should never happen, but it does happen because I'm not that smart and forget I can nil Status
|
||||
// for some reason that makes sense in my head. again, I'm not that smart
|
||||
log.Warn("status window wasn't created")
|
||||
return
|
||||
}
|
||||
newRepo.Status.Toggle()
|
||||
})
|
||||
|
||||
newRepo.endBox.NewButton("show diff", func() {
|
||||
r.reposbox.Disable()
|
||||
// newRepo.Status.XtermNohup([]string{"git diff"})
|
||||
newRepo.Status.Xterm("git diff; bash")
|
||||
r.reposbox.Enable()
|
||||
})
|
||||
|
||||
newRepo.endBox.NewButton("commit all", func() {
|
||||
r.reposbox.Disable()
|
||||
// restore anything staged so everything can be reviewed
|
||||
newRepo.Status.RunCmd([]string{"git", "restore", "--staged", "."})
|
||||
newRepo.Status.XtermWait("git diff")
|
||||
newRepo.Status.XtermWait("git add --all")
|
||||
newRepo.Status.XtermWait("git commit -a")
|
||||
newRepo.Status.XtermWait("git push")
|
||||
if newRepo.Status.CheckDirty() {
|
||||
// commit was not done, restore diff
|
||||
newRepo.Status.RunCmd([]string{"git", "restore", "--staged", "."})
|
||||
} else {
|
||||
newRepo.NewScan()
|
||||
}
|
||||
r.reposbox.Enable()
|
||||
})
|
||||
|
||||
newRepo.hidden = false
|
||||
// newRepo.Status.SetMainWorkingName(master)
|
||||
// newRepo.Status.SetDevelWorkingName(devel)
|
||||
// newRepo.Status.SetUserWorkingName(user)
|
||||
|
||||
var showBuildB bool = false
|
||||
switch newRepo.Status.RepoType() {
|
||||
case "binary":
|
||||
// log.Info("compile here. Show()")
|
||||
showBuildB = true
|
||||
case "library":
|
||||
// log.Info("library here. Hide()")
|
||||
default:
|
||||
// log.Info("unknown RepoType", newRepo.Status.RepoType())
|
||||
}
|
||||
if showBuildB {
|
||||
newRepo.endBox.NewButton("build", func() {
|
||||
newRepo.Status.Build()
|
||||
switch r.viewName {
|
||||
case "autotypist":
|
||||
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
||||
newRepo.endBox.NewButton("Configure", func() {
|
||||
if newRepo.Status == nil {
|
||||
// this should never happen, but it does happen because I'm not that smart and forget I can nil Status
|
||||
// for some reason that makes sense in my head. again, I'm not that smart
|
||||
log.Warn("status window wasn't created")
|
||||
return
|
||||
}
|
||||
newRepo.Status.Toggle()
|
||||
})
|
||||
|
||||
newRepo.endBox.NewButton("show diff", func() {
|
||||
r.reposbox.Disable()
|
||||
// newRepo.Status.XtermNohup([]string{"git diff"})
|
||||
newRepo.Status.Xterm("git diff; bash")
|
||||
r.reposbox.Enable()
|
||||
})
|
||||
|
||||
newRepo.endBox.NewButton("commit all", func() {
|
||||
r.reposbox.Disable()
|
||||
// restore anything staged so everything can be reviewed
|
||||
newRepo.Status.RunCmd([]string{"git", "restore", "--staged", "."})
|
||||
newRepo.Status.XtermWait("git diff")
|
||||
newRepo.Status.XtermWait("git add --all")
|
||||
newRepo.Status.XtermWait("git commit -a")
|
||||
newRepo.Status.XtermWait("git push")
|
||||
if newRepo.Status.CheckDirty() {
|
||||
// commit was not done, restore diff
|
||||
newRepo.Status.RunCmd([]string{"git", "restore", "--staged", "."})
|
||||
} else {
|
||||
newRepo.NewScan()
|
||||
}
|
||||
r.reposbox.Enable()
|
||||
})
|
||||
|
||||
// newRepo.Status.SetMainWorkingName(master)
|
||||
// newRepo.Status.SetDevelWorkingName(devel)
|
||||
// newRepo.Status.SetUserWorkingName(user)
|
||||
|
||||
var showBuildB bool = false
|
||||
switch newRepo.Status.RepoType() {
|
||||
case "binary":
|
||||
// log.Info("compile here. Show()")
|
||||
showBuildB = true
|
||||
case "library":
|
||||
// log.Info("library here. Hide()")
|
||||
default:
|
||||
// log.Info("unknown RepoType", newRepo.Status.RepoType())
|
||||
}
|
||||
if showBuildB {
|
||||
newRepo.endBox.NewButton("build", func() {
|
||||
newRepo.Status.Build()
|
||||
})
|
||||
}
|
||||
newRepo.goSumStatus = r.blind.NewLabel("in the blind")
|
||||
case "guireleaser":
|
||||
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
||||
newRepo.endBox.NewButton("Configure", func() {
|
||||
if newRepo.Status == nil {
|
||||
// this should never happen, but it does happen because I'm not that smart and forget I can nil Status
|
||||
// for some reason that makes sense in my head. again, I'm not that smart
|
||||
log.Warn("status window wasn't created")
|
||||
return
|
||||
}
|
||||
newRepo.Status.Toggle()
|
||||
})
|
||||
|
||||
var showBuildB bool = false
|
||||
switch newRepo.Status.RepoType() {
|
||||
case "binary":
|
||||
// log.Info("compile here. Show()")
|
||||
showBuildB = true
|
||||
case "library":
|
||||
// log.Info("library here. Hide()")
|
||||
default:
|
||||
// log.Info("unknown RepoType", newRepo.Status.RepoType())
|
||||
}
|
||||
if showBuildB {
|
||||
newRepo.endBox.NewButton("build", func() {
|
||||
newRepo.Status.Build()
|
||||
})
|
||||
}
|
||||
newRepo.goSumStatus = r.blind.NewLabel("in the blind")
|
||||
default:
|
||||
}
|
||||
grid.NextRow()
|
||||
|
||||
|
|
|
@ -22,11 +22,15 @@ type RepoList struct {
|
|||
autoHidePerfect bool
|
||||
autoScan bool
|
||||
allrepos map[string]*Repo
|
||||
viewName string
|
||||
|
||||
// reposwin *gadgets.BasicWindow
|
||||
reposbox *gui.Node
|
||||
reposgrid *gui.Node
|
||||
reposgroup *gui.Node
|
||||
|
||||
// put things here that can't be seen
|
||||
blind *gui.Node
|
||||
}
|
||||
|
||||
type Repo struct {
|
||||
|
|
|
@ -10,6 +10,7 @@ func AutotypistView(parent *gui.Node) *RepoList {
|
|||
}
|
||||
me = new(RepoList)
|
||||
me.allrepos = make(map[string]*Repo)
|
||||
me.viewName = "autotypist"
|
||||
|
||||
// me.reposbox = gui.RawBox()
|
||||
me.reposbox = parent
|
||||
|
@ -25,5 +26,6 @@ func AutotypistView(parent *gui.Node) *RepoList {
|
|||
me.reposgrid.NewLabel("Status")
|
||||
me.reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||
me.reposgrid.NextRow()
|
||||
me.blind = gui.RawBox()
|
||||
return me
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package repolist
|
||||
|
||||
import "go.wit.com/gui"
|
||||
|
||||
// This creates a view of the repos
|
||||
// you can only have one at this point
|
||||
func GuireleaserView(parent *gui.Node) *RepoList {
|
||||
if me != nil {
|
||||
return me
|
||||
}
|
||||
me = new(RepoList)
|
||||
me.allrepos = make(map[string]*Repo)
|
||||
me.viewName = "guireleaser"
|
||||
|
||||
// me.reposbox = gui.RawBox()
|
||||
me.reposbox = parent
|
||||
|
||||
me.reposgroup = me.reposbox.NewGroup("go repositories (configure in ~/.config/myrepolist)")
|
||||
me.reposgrid = me.reposgroup.NewGrid("test", 0, 0)
|
||||
|
||||
me.reposgrid.NewLabel("") // path goes here
|
||||
me.reposgrid.NewLabel("last tag").SetProgName("last tag")
|
||||
me.reposgrid.NewLabel("master version")
|
||||
me.reposgrid.NewLabel("Status")
|
||||
me.reposgrid.NewLabel("GO Status")
|
||||
me.reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||
me.reposgrid.NextRow()
|
||||
me.blind = gui.RawBox()
|
||||
return me
|
||||
}
|
Loading…
Reference in New Issue