diff --git a/globalResetOptions.go b/globalResetOptions.go index aafa51f..a3c0a90 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "os" "path/filepath" "strconv" @@ -17,32 +16,31 @@ func globalResetOptions(box *gui.Node) { grid := group2.RawGrid() 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() - filename := filepath.Join(goSrcDir, "go.work") - - 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() + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { + return } - } - fmt.Fprintln(f, ")") - - me.autotypistWindow.Enable() + 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.GoPath()) + // repo.Status.MakeRedomod() + } + } + fmt.Fprintln(f, ")") + */ }) grid.NextRow() @@ -136,7 +134,7 @@ func globalResetOptions(box *gui.Node) { me.deleteGoSrcPkgB.SetLabel("WE ARE NOT KIDDING") 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) if me.deleteGoSrcPkgB.String() == "WE ARE NOT KIDDING" { me.deleteGoSrcPkgB.SetLabel(totals) diff --git a/http.go b/http.go index 4ad554c..9a74060 100644 --- a/http.go +++ b/http.go @@ -7,7 +7,6 @@ import ( "strings" "go.wit.com/lib/gui/repostatus" - "go.wit.com/lib/gui/shell" "go.wit.com/log" ) @@ -53,40 +52,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { 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" { readonly := r.URL.Query().Get("readonly") 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)) 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) if route == "/daemon" { diff --git a/tagWindow.go b/tagWindow.go index bb04127..e411c3f 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -44,50 +44,9 @@ func makeTagWindow() *tagWindow { tagW.grid = tagW.box.RawGrid() topGrid.NewButton("list all tags", func() { - me.autotypistWindow.Disable() - 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()) - } - } + log.Info("fixme") }).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 }