♻️ Better names and add printing methods
This commit is contained in:
parent
f41ac8575f
commit
d5e7f601b6
4 changed files with 41 additions and 17 deletions
|
|
@ -2,7 +2,6 @@ package convids
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"iter"
|
||||
"regexp"
|
||||
"slices"
|
||||
|
|
@ -57,24 +56,24 @@ func (ss *Shows) All() iter.Seq[*Show] {
|
|||
return slices.Values(*ss)
|
||||
}
|
||||
|
||||
func (d *Data) AllShows(silent bool) iter.Seq[*Show] {
|
||||
func (d *Data) AllShows(outputGroup GroupPrinter) iter.Seq[*Show] {
|
||||
return func(yield func(*Show) bool) {
|
||||
if d == nil || d.Config == nil {
|
||||
return
|
||||
}
|
||||
for _, show := range d.Config.Shows {
|
||||
sh := (*d.Shows)[show]
|
||||
if sh == nil || len(*sh) < 1 {
|
||||
for _, groupName := range d.Config.Groups {
|
||||
group := (*d.Shows)[groupName]
|
||||
if group == nil || len(*group) < 1 {
|
||||
continue
|
||||
}
|
||||
if !silent {
|
||||
fmt.Printf("Checking %s shows\n\n", show)
|
||||
if outputGroup != nil {
|
||||
outputGroup(groupName, *group)
|
||||
}
|
||||
for s := range sh.All() {
|
||||
if s == nil {
|
||||
for sh := range group.All() {
|
||||
if sh == nil {
|
||||
continue
|
||||
}
|
||||
if !yield(s) {
|
||||
if !yield(sh) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue