summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-11-03 06:50:10 -0600
committerJeff Carr <[email protected]>2025-11-03 06:50:10 -0600
commitcfcd378646109344bcb2224622660e9a180f6570 (patch)
tree5abbac365e7e9754c91a641d6dae98e830113c8a
parent7048a8df551807ed72ff2d77baec17a9b65112ea (diff)
testing remote refs stuffHEADv0.0.39v0.0.38v0.0.37masterdevel
-rw-r--r--Makefile6
-rw-r--r--argv.go1
-rw-r--r--complete.go23
-rw-r--r--doRepo.go63
-rw-r--r--main.go9
5 files changed, 91 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 052bb4a..eec989b 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,12 @@ BUILDTIME = $(shell date +%s)
default: install
regex clean
+test-go.wit.com-apps-go-clone: install
+ regex --repo go.wit.com/apps/go-clone
+
+test-go.wit.com-apps-go-clone-resort: install
+ RESORT=true regex --repo go.wit.com/apps/go-clone
+
vet:
@GO111MODULE=off go vet
@echo this go binary package builds okay
diff --git a/argv.go b/argv.go
index 6d94f1f..208f04a 100644
--- a/argv.go
+++ b/argv.go
@@ -9,6 +9,7 @@ type args struct {
Uuid string `arg:"--uuid" help:"look at this uuid"`
Topic string `arg:"--topic" help:"set the topic"`
JsonFile string `arg:"--json" help:"import a JSON file from gemini-cli"`
+ Repo string `arg:"--repo" help:"what repo to look at"`
Interact *EmptyCmd `arg:"subcommand:interact" help:"open env EDITOR"`
Playback *PlaybackCmd `arg:"subcommand:playback" help:"dump your prior conversations to the terminal'"`
NewChat *PlaybackCmd `arg:"subcommand:newchat" help:"used by gemini-cli on startup"`
diff --git a/complete.go b/complete.go
index 69a1d0c..fa2fc21 100644
--- a/complete.go
+++ b/complete.go
@@ -25,24 +25,25 @@ regex -- interact with Googles' Gemini AI
}
func (args) MustParse() error {
- me.pp = arg.MustParse(&argv)
+ me.pp = arg.MustParseArgv(&argv)
return nil
}
// sends the strings to bash or zsh that will be your options
func (a args) DoAutoComplete() error {
+ var err error
+ me.pp, err = arg.ParseFlagsArgv(&argv)
+ if err != nil {
+ fmt.Fprintf(argvpb.Stddbg, "go-args parseFlagsArgv(%v) finished autocomplete\n", err)
+ }
+ return err
+}
+
+func (args) Match() bool {
if argvpb.PB.GetCmd() == "" {
matches := []string{"--bash", "interact", "playback", "clean", "--version"}
fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(matches, " "))
- return nil
- }
- var err error
- if me.pp == nil {
- me.pp, err = arg.ParseFlagsArgv(&argv)
- if err != nil {
- return err
- }
+ return true
}
- err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...)
- return err
+ return false
}
diff --git a/doRepo.go b/doRepo.go
new file mode 100644
index 0000000..063fc12
--- /dev/null
+++ b/doRepo.go
@@ -0,0 +1,63 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// An app to submit patches for the 30 GO GUI repos
+
+import (
+ "errors"
+
+ "go.wit.com/lib/env"
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+func doRepoRefs(namespace string) error {
+ forge, err := forgepb.Init()
+ if err != nil {
+ errors.Join(err, errors.New("forge init failed"))
+ }
+ env.PrintTable()
+ r := forge.Repos.FindByNamespace(namespace)
+ if r == nil {
+ return errors.New("repo not found")
+ }
+ stats, err := r.LoadRefs()
+ if err != nil {
+ return err
+ }
+
+ if env.True("resort") {
+ stats.SaveByHash()
+ log.Info("stats should have been resorted and saved")
+ } else {
+ footer := stats.PrintTableLimit(10)
+ log.Info("stats footer:", footer)
+
+ err = r.UpdateRefs(stats)
+ if err != nil {
+ // return err
+ }
+ }
+
+ for _, rmote := range r.Config.Remotes {
+ morestats, err := r.MakeRemoteRefs(rmote.Name)
+ if err != nil {
+ // return err
+ }
+ if env.True("resort") {
+ morestats.SaveByHash()
+ log.Info("stats should have been resorted and saved")
+ } else {
+ footer := morestats.PrintTableLimit(10)
+ log.Info("full remote refs footer:", footer)
+ }
+ err = r.UpdateRemoteRefs(rmote.Name)
+ if err != nil {
+ log.Info("update returned err", err)
+ }
+ }
+
+ return nil
+}
diff --git a/main.go b/main.go
index 77ac462..0082c19 100644
--- a/main.go
+++ b/main.go
@@ -51,6 +51,15 @@ func main() {
badExit(err)
}
+ if argv.Repo != "" {
+ err := doRepoRefs(argv.Repo)
+ if err != nil {
+ argvpb.BadExit("MakeRefs() failed", err)
+ }
+
+ argvpb.GoodExit("MakeRefs() ok")
+ }
+
if argv.JsonFile != "" {
doJSON()
okExit("")