cleaner repo list window

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-20 18:45:55 -06:00
parent 5f382cd5e3
commit 70bea42623
5 changed files with 66 additions and 40 deletions

View File

@ -89,7 +89,10 @@ func globalBuildOptions(box *gui.Node) {
newBranch.SetText("jcarr") newBranch.SetText("jcarr")
group2 := vbox.NewGroup("Run in every git repository") group2 := vbox.NewGroup("Run in every git repository")
group2.NewButton("git status", func() { me.stopOnErrors = group2.NewCheckbox("Stop on errors")
me.stopOnErrors.SetChecked(true)
group2.NewButton("run git status", func() {
quickCmdDoNotRun = false quickCmdDoNotRun = false
quickCmdLastPath = "~/go/src" quickCmdLastPath = "~/go/src"
quickCmds = [][]string{} quickCmds = [][]string{}
@ -101,7 +104,16 @@ func globalBuildOptions(box *gui.Node) {
}) })
me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() { me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
log.Info("TODO: remove them") quickCmdDoNotRun = false
for _, path := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path
if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) {
log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool())
if me.stopOnErrors.Bool() {
return
}
}
}
}) })
me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() { me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
@ -113,4 +125,13 @@ func globalBuildOptions(box *gui.Node) {
quickCmd(fullpath, []string{"go", "mod", "tidy"}) quickCmd(fullpath, []string{"go", "mod", "tidy"})
} }
}) })
me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() {
quickCmdDoNotRun = false
for _, path := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path
quickCmd(fullpath, []string{"git", "checkout", "go.mod"})
quickCmd(fullpath, []string{"git", "checkout", "go.sum"})
}
})
} }

30
main.go
View File

@ -44,17 +44,17 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.path = path newRepo.path = path
newRepo.pLabel = grid.NewLabel(path).SetProgName("path") newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
newRepo.masterName = grid.NewLabel("").SetProgName("masterName") newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion") newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
newRepo.develName = grid.NewLabel("").SetProgName("develName")
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion") newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
newRepo.userName = grid.NewLabel("").SetProgName("userName")
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion") newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
newRepo.dirtyLabel = grid.NewLabel("") newRepo.dirtyLabel = grid.NewLabel("")
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
newRepo.showButton = grid.NewButton("Show()", func() { newRepo.showButton = grid.NewButton("Show()", func() {
if newRepo.status == nil { if newRepo.status == nil {
log.Warn("status window doesn't exist") log.Warn("status window doesn't exist")
@ -101,18 +101,20 @@ func repoworld() {
} }
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)") reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
reposgrid = reposgroup.NewGrid("test", 11, 1) reposgrid = reposgroup.NewGrid("test", 8, 1)
reposgrid.NewLabel("") // path goes here
reposgrid.NewLabel("")
reposgrid.NewLabel("last tag").SetProgName("last tag") reposgrid.NewLabel("last tag").SetProgName("last tag")
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
reposgrid.NewLabel("master") reposgrid.NewLabel("master version")
reposgrid.NewLabel("version") reposgrid.NewLabel("devel version")
reposgrid.NewLabel("devel") reposgrid.NewLabel("user version")
reposgrid.NewLabel("version")
reposgrid.NewLabel("user")
reposgrid.NewLabel("version")
reposgrid.NewLabel("Status") reposgrid.NewLabel("Status")
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
reposgrid.NewLabel("Show()") reposgrid.NewLabel("Show()")
repos := myrepolist() repos := myrepolist()

View File

@ -48,12 +48,10 @@ func (r *repo) Hide() {
r.lastTag.Hide() r.lastTag.Hide()
r.vLabel.Hide() r.vLabel.Hide()
r.masterName.Hide()
r.masterVersion.Hide() r.masterVersion.Hide()
r.develName.Hide()
r.develVersion.Hide() r.develVersion.Hide()
r.userName.Hide()
r.userVersion.Hide() r.userVersion.Hide()
r.dirtyLabel.Hide() r.dirtyLabel.Hide()
r.showButton.Hide() r.showButton.Hide()
r.hidden = true r.hidden = true
@ -66,12 +64,10 @@ func (r *repo) Show() {
r.lastTag.Show() r.lastTag.Show()
r.vLabel.Show() r.vLabel.Show()
r.masterName.Show()
r.masterVersion.Show() r.masterVersion.Show()
r.develName.Show()
r.develVersion.Show() r.develVersion.Show()
r.userName.Show()
r.userVersion.Show() r.userVersion.Show()
r.dirtyLabel.Show() r.dirtyLabel.Show()
r.showButton.Show() r.showButton.Show()
r.hidden = false r.hidden = false

30
scan.go
View File

@ -19,20 +19,26 @@ func (r *repo) newScan() bool {
log.Warn("repo does not exist", r.getPath()) log.Warn("repo does not exist", r.getPath())
return false return false
} }
mn := r.status.GetMasterBranchName() mname := r.status.GetMasterBranchName()
r.masterName.SetLabel(mn) mver := r.status.GetMasterVersion()
mv := r.status.GetMasterVersion() if mname != "guimaster" {
r.masterVersion.SetLabel(mv) mver = mver + " (" + mname + ")"
}
r.masterVersion.SetLabel(mver)
dn := r.status.GetDevelBranchName() dname := r.status.GetDevelBranchName()
r.develName.SetLabel(dn) dver := r.status.GetDevelVersion()
dv := r.status.GetDevelVersion() if dname != "devel" {
r.develVersion.SetLabel(dv) dver = dver + " (" + dname + ")"
}
r.develVersion.SetLabel(dver)
un := r.status.GetUserBranchName() uname := r.status.GetUserBranchName()
r.userName.SetLabel(un) uver := r.status.GetUserVersion()
uv := r.status.GetUserVersion() if uname != "jcarr" {
r.userVersion.SetLabel(uv) uver = uver + " (" + uname + ")"
}
r.userVersion.SetLabel(uver)
cbname := r.status.GetCurrentBranchName() cbname := r.status.GetCurrentBranchName()
cbversion := r.status.GetCurrentBranchVersion() cbversion := r.status.GetCurrentBranchVersion()

View File

@ -20,8 +20,8 @@ type repoType struct {
allrepos map[*repo]string allrepos map[*repo]string
myGui *gui.Node myGui *gui.Node
// #### autotypist window
autotypistWindow *gadgets.BasicWindow autotypistWindow *gadgets.BasicWindow
// #### autotypist Global Display Options // #### autotypist Global Display Options
autoHidePerfect *gui.Node autoHidePerfect *gui.Node
@ -39,8 +39,9 @@ type repoType struct {
// this button will regenerate everyones go.mod & go.sum // this button will regenerate everyones go.mod & go.sum
rerunGoMod *gui.Node rerunGoMod *gui.Node
// #### autotypist Global Distructive & Reset Options
// #### autotypist window end // if checked, will stop trying to os.Exec() things after failure
stopOnErrors *gui.Node
} }
var cmds *gui.Node var cmds *gui.Node
@ -61,11 +62,11 @@ type repo struct {
// tagsDrop *gui.Node // list of all tags // tagsDrop *gui.Node // list of all tags
dirtyLabel *gui.Node // git state (dirty or not?) dirtyLabel *gui.Node // git state (dirty or not?)
masterName *gui.Node // the master branch name // masterName *gui.Node // the master branch name
masterVersion *gui.Node // the master branch version masterVersion *gui.Node // the master branch version
develName *gui.Node // the devel branch name // develName *gui.Node // the devel branch name
develVersion *gui.Node // the devel branch version develVersion *gui.Node // the devel branch version
userName *gui.Node // the jcarr branch name // userName *gui.Node // the jcarr branch name
userVersion *gui.Node // the jcarr branch version userVersion *gui.Node // the jcarr branch version
cButton *gui.Node // commit button cButton *gui.Node // commit button