summaryrefslogtreecommitdiff
path: root/iterByMode.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-19 06:32:34 -0500
committerJeff Carr <[email protected]>2025-10-19 06:32:34 -0500
commit5a8bc9367e17e4e03be389a8896a93ed8d4c93c1 (patch)
tree6a6c0275d2f91c1eb39bd3d34bb42b32ec1c698d /iterByMode.go
parentb8012e05654c9823099fd4bb767c73a4229559f8 (diff)
notes for laterv0.0.186
Diffstat (limited to 'iterByMode.go')
-rw-r--r--iterByMode.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/iterByMode.go b/iterByMode.go
new file mode 100644
index 0000000..37866ec
--- /dev/null
+++ b/iterByMode.go
@@ -0,0 +1,25 @@
+package forgepb
+
+import (
+ "iter"
+ "strings"
+
+ "go.wit.com/lib/protobuf/gitpb"
+)
+
+func (f *Forge) IterByMode() iter.Seq[*gitpb.Repo] {
+ if f == nil {
+ panic("forge is not initialized")
+ }
+ repos := gitpb.NewRepos()
+ if f.Config.Mode == ForgeMode_NORMAL {
+ for r := range f.Repos.IterAll() {
+ if !strings.HasPrefix(r.Namespace, "go.wit.com") {
+ continue
+ }
+ repos.Append(r)
+ }
+ return repos.IterByNamespace()
+ }
+ return f.Repos.IterAll()
+}