summaryrefslogtreecommitdiff
path: root/doClean.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-18 15:50:06 -0600
committerJeff Carr <[email protected]>2025-01-18 15:50:06 -0600
commitcbbd43f7b59cee14ed3c83d1da33a04cf8e73bbc (patch)
tree173f1d0d15b66962f16d3e3366f685da0269cda4 /doClean.go
parent4444e942ea0c179f94ef4baa8d8dc268f807a8f4 (diff)
start a 'clean' argv option
Diffstat (limited to 'doClean.go')
-rw-r--r--doClean.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/doClean.go b/doClean.go
new file mode 100644
index 0000000..11e4b7e
--- /dev/null
+++ b/doClean.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "fmt"
+
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func doClean() error {
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ if err := doCleanRepo(repo); err != nil {
+ badExit(err)
+ }
+ }
+ return nil
+}
+
+func doCleanRepo(repo *gitpb.Repo) error {
+ log.Info("Cleaning:", repo.GetGoPath())
+ if repo.GitConfig == nil {
+ return fmt.Errorf("GitConfig == nil")
+ }
+
+ for _, l := range repo.GitConfig.Local {
+ log.Info("\tlocal branch name:", l.Name)
+ }
+
+ for name, b := range repo.GitConfig.Branches {
+ log.Info("\tlocal branch name:", name, b.Merge, b.Remote)
+ }
+ return nil
+}