2024-02-07 13:04:25 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/gui"
|
|
|
|
"go.wit.com/log"
|
|
|
|
|
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/lib/gui/repostatus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var tagW *tagWindow
|
|
|
|
|
|
|
|
type tagWindow struct {
|
|
|
|
win *gadgets.BasicWindow
|
|
|
|
box *gui.Node
|
|
|
|
grid *gui.Node
|
|
|
|
group *gui.Node
|
|
|
|
allTags []*gitTag
|
|
|
|
}
|
|
|
|
|
|
|
|
type gitTag struct {
|
|
|
|
rs *repostatus.RepoStatus
|
|
|
|
hidden bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeTagWindow() *tagWindow {
|
|
|
|
if tagW != nil {
|
|
|
|
tagW.win.Toggle()
|
|
|
|
return tagW
|
|
|
|
}
|
|
|
|
tagW = new(tagWindow)
|
|
|
|
tagW.win = gadgets.NewBasicWindow(me.myGui, "git tag tasks")
|
|
|
|
tagW.win.Custom = func() {
|
|
|
|
log.Warn("got to close")
|
|
|
|
}
|
|
|
|
|
|
|
|
tagW.win.Make()
|
|
|
|
tagW.win.StandardClose()
|
|
|
|
tagW.win.Draw()
|
|
|
|
|
|
|
|
tagW.box = tagW.win.Box()
|
2024-02-12 15:24:35 -06:00
|
|
|
topGrid := tagW.box.RawGrid()
|
2024-02-07 13:04:25 -06:00
|
|
|
tagW.group = tagW.box.NewGroup("tags")
|
2024-02-09 04:53:26 -06:00
|
|
|
tagW.grid = tagW.box.RawGrid()
|
2024-02-07 13:04:25 -06:00
|
|
|
|
2024-02-12 15:24:35 -06:00
|
|
|
topGrid.NewButton("list all tags", func() {
|
2024-02-07 13:04:25 -06:00
|
|
|
me.autotypistWindow.Disable()
|
|
|
|
defer me.autotypistWindow.Enable()
|
2024-11-14 21:46:45 -06:00
|
|
|
loop := me.repos.View.ReposSortByName()
|
|
|
|
for loop.Scan() {
|
|
|
|
repo := loop.Repo()
|
2024-02-17 08:38:44 -06:00
|
|
|
allTags := repo.AllTags()
|
2024-02-07 13:04:25 -06:00
|
|
|
for _, t := range allTags {
|
2024-02-17 15:47:46 -06:00
|
|
|
log.Info("found tag:", t.TagString(), "from", repo.Name())
|
2024-02-07 13:04:25 -06:00
|
|
|
}
|
|
|
|
}
|
2024-02-12 15:24:35 -06:00
|
|
|
}).SetProgName("TAGSLISTALL")
|
2024-02-07 13:04:25 -06:00
|
|
|
|
2024-02-12 15:24:35 -06:00
|
|
|
topGrid.NewButton("delete all dup tags", func() {
|
2024-02-07 13:04:25 -06:00
|
|
|
me.autotypistWindow.Disable()
|
|
|
|
defer me.autotypistWindow.Enable()
|
2024-11-14 21:46:45 -06:00
|
|
|
loop := me.repos.View.ReposSortByName()
|
|
|
|
for loop.Scan() {
|
|
|
|
repo := loop.Repo()
|
2024-02-17 15:47:46 -06:00
|
|
|
if repo.GoPath() == "go.wit.com/lib/gadgets" {
|
2024-02-09 04:53:26 -06:00
|
|
|
// only do log for now
|
|
|
|
} else {
|
|
|
|
// continue
|
|
|
|
}
|
2024-02-17 08:38:44 -06:00
|
|
|
tagsW := repo.TagsBox()
|
2024-02-09 04:08:21 -06:00
|
|
|
tagsW.PruneSmart()
|
2024-02-07 13:04:25 -06:00
|
|
|
deleteTags := tagsW.List()
|
|
|
|
for _, t := range deleteTags {
|
2024-02-09 04:53:26 -06:00
|
|
|
tagW.grid.NewLabel(t.TagString())
|
2024-02-17 15:47:46 -06:00
|
|
|
tagW.grid.NewLabel(repo.Name())
|
2024-02-09 04:53:26 -06:00
|
|
|
tagW.grid.NewButton("delete", func() {
|
2024-02-17 08:38:44 -06:00
|
|
|
repo.DeleteTag(t)
|
2024-02-09 04:53:26 -06:00
|
|
|
})
|
|
|
|
tagW.grid.NextRow()
|
2024-02-07 13:04:25 -06:00
|
|
|
if me.autoDryRun.Checked() {
|
2024-02-17 15:47:46 -06:00
|
|
|
log.Info("delete tag --dry-run:", t.TagString(), "from", repo.Name())
|
2024-02-07 13:04:25 -06:00
|
|
|
} else {
|
2024-02-17 15:47:46 -06:00
|
|
|
log.Info("Deleting tag:", t.TagString(), "from", repo.Name())
|
2024-02-17 08:38:44 -06:00
|
|
|
go repo.DeleteTag(t)
|
2024-02-09 05:24:24 -06:00
|
|
|
log.Sleep(1)
|
2024-02-07 13:04:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
return tagW
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *gitTag) Hide() {
|
|
|
|
t.hidden = true
|
|
|
|
}
|