Compare commits
4 Commits
15bcdb006e
...
269490693e
Author | SHA1 | Date |
---|---|---|
|
269490693e | |
|
85d74dd70d | |
|
c22d0f4866 | |
|
595f4c6eb3 |
69
main.go
69
main.go
|
@ -49,25 +49,22 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
log.Warn("status window doesn't exist")
|
log.Warn("status window doesn't exist")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Warn("status window exists. trying Update() here")
|
log.Warn("status window exists. trying Show() here")
|
||||||
newRepo.status.Toggle()
|
newRepo.status.Show()
|
||||||
})
|
})
|
||||||
grid.NewButton("TestDraw()", func () {
|
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")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Warn("status window exists. trying TestDraw() here")
|
log.Warn("status window exists. trying TestDraw() here")
|
||||||
newRepo.status.TestDraw()
|
newRepo.status.Show()
|
||||||
})
|
})
|
||||||
if path == "" {
|
if path == "" {
|
||||||
newRepo.cButton.Hide()
|
newRepo.cButton.Hide()
|
||||||
newRepo.pButton.Hide()
|
newRepo.pButton.Hide()
|
||||||
}
|
}
|
||||||
newRepo.status = repostatus.New(myGui, newRepo.path)
|
newRepo.status = repostatus.New(myGui, newRepo.path)
|
||||||
newRepo.status.Horizontal()
|
|
||||||
newRepo.status.Make()
|
|
||||||
newRepo.status.Make2()
|
|
||||||
newRepo.status.SetMasterName(master)
|
newRepo.status.SetMasterName(master)
|
||||||
newRepo.status.SetDevelName(devel)
|
newRepo.status.SetDevelName(devel)
|
||||||
newRepo.status.SetUserName(user)
|
newRepo.status.SetUserName(user)
|
||||||
|
@ -78,25 +75,25 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
func repoworld() {
|
func repoworld() {
|
||||||
win := gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.")
|
reposwin = gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.")
|
||||||
|
reposwin.Make()
|
||||||
|
|
||||||
box := win.Box().NewBox("bw vbox", false)
|
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
||||||
// box2 := win.Box().NewBox("bw vbox", false)
|
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
||||||
group := box.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
reposgrid = reposgroup.NewGrid("test", 11, 1)
|
||||||
grid := group.NewGrid("test", 11, 1)
|
|
||||||
|
|
||||||
grid.NewLabel("")
|
reposgrid.NewLabel("")
|
||||||
grid.NewLabel("branch")
|
reposgrid.NewLabel("branch")
|
||||||
grid.NewLabel("last tag")
|
reposgrid.NewLabel("last tag")
|
||||||
grid.NewLabel("Current Version")
|
reposgrid.NewLabel("Current Version")
|
||||||
// grid.NewLabel("tags")
|
// reposgrid.NewLabel("tags")
|
||||||
grid.NewLabel("master")
|
reposgrid.NewLabel("master")
|
||||||
grid.NewLabel("devel")
|
reposgrid.NewLabel("devel")
|
||||||
grid.NewLabel("user")
|
reposgrid.NewLabel("user")
|
||||||
grid.NewLabel("Status")
|
reposgrid.NewLabel("Status")
|
||||||
grid.NewLabel("commit")
|
reposgrid.NewLabel("commit")
|
||||||
grid.NewLabel("Toggle()")
|
reposgrid.NewLabel("Toggle()")
|
||||||
grid.NewLabel("Draw()")
|
reposgrid.NewLabel("Draw()")
|
||||||
|
|
||||||
repos := myrepolist()
|
repos := myrepolist()
|
||||||
for _, line := range repos {
|
for _, line := range repos {
|
||||||
|
@ -106,8 +103,28 @@ func repoworld() {
|
||||||
if dbranch == "" { dbranch = "devel" }
|
if dbranch == "" { dbranch = "devel" }
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
if ubranch == "" { ubranch = usr.Username }
|
if ubranch == "" { ubranch = usr.Username }
|
||||||
addRepo(grid, path, mbranch, dbranch, ubranch)
|
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
|
||||||
}
|
}
|
||||||
|
|
||||||
win.Draw()
|
box2 := reposwin.Box().NewBox("bw vbox", false)
|
||||||
|
box2.NewButton("reposgrid.Margin()", func () {
|
||||||
|
log.Warn("reposgrid.Margin() RUN NOW")
|
||||||
|
reposgrid.Margin()
|
||||||
|
log.Warn("reposgrid.Pad() RUN NOW")
|
||||||
|
reposgrid.Pad()
|
||||||
|
})
|
||||||
|
|
||||||
|
box2.NewButton("status.Update() all", func () {
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
repo.status.Update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
box2.NewButton("rescan all", func () {
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
repo.newScan()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
reposwin.Draw()
|
||||||
}
|
}
|
||||||
|
|
51
repolist.go
51
repolist.go
|
@ -7,7 +7,6 @@ import (
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui/gadgets/repostatus"
|
|
||||||
"go.wit.com/apps/control-panel-dns/smartwindow"
|
"go.wit.com/apps/control-panel-dns/smartwindow"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,53 +61,3 @@ func myrepolist() []string {
|
||||||
lines := strings.Split(out, "\n")
|
lines := strings.Split(out, "\n")
|
||||||
return lines
|
return lines
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) newScan() bool {
|
|
||||||
if r.status == nil {
|
|
||||||
log.Warn("repo.status = nil. not initialized for some reason")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// r.scan()
|
|
||||||
if repostatus.VerifyLocalGoRepo(r.getPath()) {
|
|
||||||
log.Warn("repo actually exists", r.getPath())
|
|
||||||
} else {
|
|
||||||
log.Warn("repo does not exist", r.getPath())
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
mn := r.status.GetMasterName()
|
|
||||||
mv := r.status.GetMasterVersion()
|
|
||||||
r.masterVersion.Set(mn + " " + mv)
|
|
||||||
|
|
||||||
dn := r.status.GetDevelName()
|
|
||||||
dv := r.status.GetDevelVersion()
|
|
||||||
r.develVersion.Set(dn + " " + dv)
|
|
||||||
|
|
||||||
un := r.status.GetUserName()
|
|
||||||
uv := r.status.GetUserVersion()
|
|
||||||
r.jcarrVersion.Set(un + " " + uv)
|
|
||||||
|
|
||||||
cbname := r.status.GetCurrentBranchName()
|
|
||||||
cbversion := r.status.GetCurrentBranchVersion()
|
|
||||||
ltversion := r.status.GetLastTagVersion()
|
|
||||||
r.lastLabel.Set(cbname + " " + cbversion)
|
|
||||||
r.vLabel.Set(cbname + " " + ltversion)
|
|
||||||
|
|
||||||
if r.status.CheckDirty() {
|
|
||||||
log.Warn("CheckDirty() true")
|
|
||||||
r.dirtyLabel.Set("dirty")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
log.Warn("CheckDirty() no")
|
|
||||||
r.dirtyLabel.Set("not dirty")
|
|
||||||
|
|
||||||
if r.status.CheckBranches() {
|
|
||||||
log.Warn("Branches are Perfect")
|
|
||||||
r.dirtyLabel.SetText("PEFECT")
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
log.Warn("Branches are not Perfect")
|
|
||||||
r.dirtyLabel.SetText("merge")
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
// This is a simple example
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
"go.wit.com/gui/gadgets/repostatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (r *repo) newScan() bool {
|
||||||
|
if r.status == nil {
|
||||||
|
log.Warn("repo.status = nil. not initialized for some reason")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// r.scan()
|
||||||
|
if repostatus.VerifyLocalGoRepo(r.getPath()) {
|
||||||
|
log.Warn("repo actually exists", r.getPath())
|
||||||
|
} else {
|
||||||
|
log.Warn("repo does not exist", r.getPath())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
mn := r.status.GetMasterName()
|
||||||
|
mv := r.status.GetMasterVersion()
|
||||||
|
r.masterVersion.Set(mn + "\n" + mv)
|
||||||
|
|
||||||
|
dn := r.status.GetDevelName()
|
||||||
|
dv := r.status.GetDevelVersion()
|
||||||
|
r.develVersion.Set(dn + "\n" + dv)
|
||||||
|
|
||||||
|
un := r.status.GetUserName()
|
||||||
|
uv := r.status.GetUserVersion()
|
||||||
|
r.jcarrVersion.Set(un + "\n" + uv)
|
||||||
|
|
||||||
|
cbname := r.status.GetCurrentBranchName()
|
||||||
|
cbversion := r.status.GetCurrentBranchVersion()
|
||||||
|
ltversion := r.status.GetLastTagVersion()
|
||||||
|
r.lastLabel.Set(cbname + "\n" + cbversion)
|
||||||
|
r.vLabel.Set(cbname + "\n" + ltversion)
|
||||||
|
|
||||||
|
if r.status.CheckDirty() {
|
||||||
|
log.Warn("CheckDirty() true")
|
||||||
|
r.dirtyLabel.Set("dirty")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
log.Warn("CheckDirty() no")
|
||||||
|
r.dirtyLabel.Set("not dirty")
|
||||||
|
|
||||||
|
if r.status.CheckBranches() {
|
||||||
|
log.Warn("Branches are Perfect")
|
||||||
|
r.dirtyLabel.SetText("PEFECT")
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
log.Warn("Branches are not Perfect")
|
||||||
|
r.dirtyLabel.SetText("merge")
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
16
structs.go
16
structs.go
|
@ -1,20 +1,18 @@
|
||||||
// This is a simple example
|
// watch all your go git repos
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "os/user"
|
|
||||||
// "io/ioutil"
|
|
||||||
// "strings"
|
|
||||||
|
|
||||||
// "go.wit.com/log"
|
|
||||||
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
// "go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
"go.wit.com/gui/gadgets/repostatus"
|
"go.wit.com/gui/gadgets/repostatus"
|
||||||
// "go.wit.com/apps/control-panel-dns/smartwindow"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// the main window nodes
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
var reposwin *gadgets.BasicWindow
|
||||||
|
var reposbox *gui.Node
|
||||||
|
var reposgrid *gui.Node
|
||||||
|
var reposgroup *gui.Node
|
||||||
|
|
||||||
var allrepos []*repo
|
var allrepos []*repo
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue