aboutsummaryrefslogtreecommitdiff
path: root/pkg/config/feed.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/config/feed.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkg/config/feed.go b/pkg/config/feed.go
new file mode 100644
index 0000000..03494d3
--- /dev/null
+++ b/pkg/config/feed.go
@@ -0,0 +1,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()
+}