rm old code
This commit is contained in:
parent
92d5f6b92c
commit
e4a8fa53a7
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -17,32 +16,31 @@ func globalResetOptions(box *gui.Node) {
|
||||||
grid := group2.RawGrid()
|
grid := group2.RawGrid()
|
||||||
|
|
||||||
grid.NewButton("remake 'go.work' file", func() {
|
grid.NewButton("remake 'go.work' file", func() {
|
||||||
me.autotypistWindow.Disable()
|
me.repos.View.MakeGoWork()
|
||||||
|
/*
|
||||||
|
goSrcDir := me.goSrcPwd.String()
|
||||||
|
filename := filepath.Join(goSrcDir, "go.work")
|
||||||
|
|
||||||
goSrcDir := me.goSrcPwd.String()
|
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
|
||||||
filename := filepath.Join(goSrcDir, "go.work")
|
if err != nil {
|
||||||
|
return
|
||||||
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
fmt.Fprintln(f, "go 1.21.4")
|
|
||||||
fmt.Fprintln(f, "")
|
|
||||||
fmt.Fprintln(f, "use (")
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
if repo.Status.Exists("go.mod") {
|
|
||||||
fmt.Fprintln(f, "\t"+repo.Status.GoPath())
|
|
||||||
} else {
|
|
||||||
log.Info("missing go.mod for", repo.Status.Path())
|
|
||||||
// repo.Status.MakeRedomod()
|
|
||||||
}
|
}
|
||||||
}
|
defer f.Close()
|
||||||
fmt.Fprintln(f, ")")
|
fmt.Fprintln(f, "go 1.21.4")
|
||||||
|
fmt.Fprintln(f, "")
|
||||||
me.autotypistWindow.Enable()
|
fmt.Fprintln(f, "use (")
|
||||||
|
loop := me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
if repo.Status.Exists("go.mod") {
|
||||||
|
fmt.Fprintln(f, "\t"+repo.Status.GoPath())
|
||||||
|
} else {
|
||||||
|
log.Info("missing go.mod for", repo.Status.GoPath())
|
||||||
|
// repo.Status.MakeRedomod()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Fprintln(f, ")")
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
|
@ -136,7 +134,7 @@ func globalResetOptions(box *gui.Node) {
|
||||||
me.deleteGoSrcPkgB.SetLabel("WE ARE NOT KIDDING")
|
me.deleteGoSrcPkgB.SetLabel("WE ARE NOT KIDDING")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var totals string = "All " + strconv.Itoa(me.repos.View.TotalGo()) + " Repos?"
|
var totals string = "All " + strconv.Itoa(me.forge.Repos.Len()) + " Repos?"
|
||||||
log.Info("totals =", totals)
|
log.Info("totals =", totals)
|
||||||
if me.deleteGoSrcPkgB.String() == "WE ARE NOT KIDDING" {
|
if me.deleteGoSrcPkgB.String() == "WE ARE NOT KIDDING" {
|
||||||
me.deleteGoSrcPkgB.SetLabel(totals)
|
me.deleteGoSrcPkgB.SetLabel(totals)
|
||||||
|
|
66
http.go
66
http.go
|
@ -7,7 +7,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/repostatus"
|
"go.wit.com/lib/gui/repostatus"
|
||||||
"go.wit.com/lib/gui/shell"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -53,40 +52,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if route == "/gitpull" {
|
|
||||||
repoName := r.URL.Query().Get("repo")
|
|
||||||
if repoName != "" {
|
|
||||||
// git pull (or go-clone of it doesn't exist)
|
|
||||||
repo := me.repos.View.FindByName(repoName)
|
|
||||||
if repo == nil {
|
|
||||||
cmd := []string{"go-clone", repoName}
|
|
||||||
header := repo.StandardHeader()
|
|
||||||
log.Info(header + strings.Join(cmd, " "))
|
|
||||||
shell.RunHttpOut(cmd, w, r)
|
|
||||||
} else {
|
|
||||||
cmd := []string{"git", "pull", "-v"}
|
|
||||||
header := repo.StandardHeader()
|
|
||||||
log.Info(header + strings.Join(cmd, " "))
|
|
||||||
shell.RunPathHttpOut(repo.Status.FullPath(), cmd, w, r)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// git pull every repo. Ignore Dirty repos
|
|
||||||
loop := me.repos.View.ReposAll()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
cmd := []string{"git", "pull", "-v"}
|
|
||||||
header := repo.StandardHeader()
|
|
||||||
if repo.CheckDirty() {
|
|
||||||
log.Info(header + "skip dirty repo")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info(header + strings.Join(cmd, " "))
|
|
||||||
shell.RunPathHttpOut(repo.Status.FullPath(), cmd, w, r)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if route == "/list" {
|
if route == "/list" {
|
||||||
readonly := r.URL.Query().Get("readonly")
|
readonly := r.URL.Query().Get("readonly")
|
||||||
onlydirty := r.URL.Query().Get("onlydirty")
|
onlydirty := r.URL.Query().Get("onlydirty")
|
||||||
|
@ -130,37 +95,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info(fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
|
log.Info(fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if route == "/goweblist" {
|
|
||||||
readonly := r.URL.Query().Get("readonly")
|
|
||||||
loop := me.repos.View.ReposAll()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
lastTag := repo.LastTag()
|
|
||||||
tag := repo.Status.NewestTag()
|
|
||||||
gitAge, err := tag.GetDate()
|
|
||||||
if err != nil {
|
|
||||||
log.Info(fmt.Sprintf("tag date error", repo.Name()))
|
|
||||||
}
|
|
||||||
// if lastTag == "" {
|
|
||||||
// lastTag = tag.Name()
|
|
||||||
// }
|
|
||||||
if repo.ReadOnly() {
|
|
||||||
if readonly == "true" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// dur := time.Since(gitAge)
|
|
||||||
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
|
|
||||||
fmt.Fprintf(w, "%s %d %s\n", repo.Name(), gitAge.Unix(), lastTag)
|
|
||||||
/*
|
|
||||||
for _, tag := range repo.Tags.ListAll() {
|
|
||||||
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// turn off timestamps for STDOUT (systemd adds them)
|
// turn off timestamps for STDOUT (systemd adds them)
|
||||||
if route == "/daemon" {
|
if route == "/daemon" {
|
||||||
|
|
43
tagWindow.go
43
tagWindow.go
|
@ -44,50 +44,9 @@ func makeTagWindow() *tagWindow {
|
||||||
tagW.grid = tagW.box.RawGrid()
|
tagW.grid = tagW.box.RawGrid()
|
||||||
|
|
||||||
topGrid.NewButton("list all tags", func() {
|
topGrid.NewButton("list all tags", func() {
|
||||||
me.autotypistWindow.Disable()
|
log.Info("fixme")
|
||||||
defer me.autotypistWindow.Enable()
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
allTags := repo.AllTags()
|
|
||||||
for _, t := range allTags {
|
|
||||||
log.Info("found tag:", t.TagString(), "from", repo.Name())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).SetProgName("TAGSLISTALL")
|
}).SetProgName("TAGSLISTALL")
|
||||||
|
|
||||||
topGrid.NewButton("delete all dup tags", func() {
|
|
||||||
me.autotypistWindow.Disable()
|
|
||||||
defer me.autotypistWindow.Enable()
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
if repo.GoPath() == "go.wit.com/lib/gadgets" {
|
|
||||||
// only do log for now
|
|
||||||
} else {
|
|
||||||
// continue
|
|
||||||
}
|
|
||||||
tagsW := repo.TagsBox()
|
|
||||||
tagsW.PruneSmart()
|
|
||||||
deleteTags := tagsW.List()
|
|
||||||
for _, t := range deleteTags {
|
|
||||||
tagW.grid.NewLabel(t.TagString())
|
|
||||||
tagW.grid.NewLabel(repo.Name())
|
|
||||||
tagW.grid.NewButton("delete", func() {
|
|
||||||
repo.DeleteTag(t)
|
|
||||||
})
|
|
||||||
tagW.grid.NextRow()
|
|
||||||
if me.autoDryRun.Checked() {
|
|
||||||
log.Info("delete tag --dry-run:", t.TagString(), "from", repo.Name())
|
|
||||||
} else {
|
|
||||||
log.Info("Deleting tag:", t.TagString(), "from", repo.Name())
|
|
||||||
go repo.DeleteTag(t)
|
|
||||||
log.Sleep(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return tagW
|
return tagW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue