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.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||||
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||||
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
|
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.hidden = false
|
||||||
// newRepo.Status.SetMainWorkingName(master)
|
switch r.viewName {
|
||||||
// newRepo.Status.SetDevelWorkingName(devel)
|
case "autotypist":
|
||||||
// newRepo.Status.SetUserWorkingName(user)
|
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||||
|
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||||
var showBuildB bool = false
|
newRepo.dirtyLabel = grid.NewLabel("")
|
||||||
switch newRepo.Status.RepoType() {
|
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||||
case "binary":
|
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
||||||
// log.Info("compile here. Show()")
|
newRepo.endBox.NewButton("Configure", func() {
|
||||||
showBuildB = true
|
if newRepo.Status == nil {
|
||||||
case "library":
|
// this should never happen, but it does happen because I'm not that smart and forget I can nil Status
|
||||||
// log.Info("library here. Hide()")
|
// for some reason that makes sense in my head. again, I'm not that smart
|
||||||
default:
|
log.Warn("status window wasn't created")
|
||||||
// log.Info("unknown RepoType", newRepo.Status.RepoType())
|
return
|
||||||
}
|
}
|
||||||
if showBuildB {
|
newRepo.Status.Toggle()
|
||||||
newRepo.endBox.NewButton("build", func() {
|
|
||||||
newRepo.Status.Build()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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()
|
grid.NextRow()
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,15 @@ type RepoList struct {
|
||||||
autoHidePerfect bool
|
autoHidePerfect bool
|
||||||
autoScan bool
|
autoScan bool
|
||||||
allrepos map[string]*Repo
|
allrepos map[string]*Repo
|
||||||
|
viewName string
|
||||||
|
|
||||||
// reposwin *gadgets.BasicWindow
|
// reposwin *gadgets.BasicWindow
|
||||||
reposbox *gui.Node
|
reposbox *gui.Node
|
||||||
reposgrid *gui.Node
|
reposgrid *gui.Node
|
||||||
reposgroup *gui.Node
|
reposgroup *gui.Node
|
||||||
|
|
||||||
|
// put things here that can't be seen
|
||||||
|
blind *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
type Repo struct {
|
type Repo struct {
|
||||||
|
|
|
@ -10,6 +10,7 @@ func AutotypistView(parent *gui.Node) *RepoList {
|
||||||
}
|
}
|
||||||
me = new(RepoList)
|
me = new(RepoList)
|
||||||
me.allrepos = make(map[string]*Repo)
|
me.allrepos = make(map[string]*Repo)
|
||||||
|
me.viewName = "autotypist"
|
||||||
|
|
||||||
// me.reposbox = gui.RawBox()
|
// me.reposbox = gui.RawBox()
|
||||||
me.reposbox = parent
|
me.reposbox = parent
|
||||||
|
@ -25,5 +26,6 @@ func AutotypistView(parent *gui.Node) *RepoList {
|
||||||
me.reposgrid.NewLabel("Status")
|
me.reposgrid.NewLabel("Status")
|
||||||
me.reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
me.reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||||
me.reposgrid.NextRow()
|
me.reposgrid.NextRow()
|
||||||
|
me.blind = gui.RawBox()
|
||||||
return me
|
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