aboutsummaryrefslogtreecommitdiff
path: root/pkg/config/feed.go
blob: 03494d33023c27a0caa34857f4641a858f17b41d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package config

import (
	"fmt"
	"strings"
)

// One stored feed
type Feed struct {
	Name    string
	Target  []string `yaml:"-"`
	Url     string
	Options `yaml:",inline"`
}

// Convenience type for all feeds
type Feeds map[string]Feed

func (feeds Feeds) String() string {
	var b strings.Builder
	app := func(a ...interface{}) {
		_, _ = fmt.Fprint(&b, a...)
	}
	app("Feeds [")

	first := true
	for k, v := range feeds {
		if !first {
			app(", ")
		}
		app(`"`, k, `"`, ": ")
		_, _ = fmt.Fprintf(&b, "%+v", v)
		first = false
	}
	app("]")

	return b.String()
}