diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-25 17:00:57 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-25 17:00:57 +0200 |
commit | 573ce1982da2e754947453fdaf0d50204873acb4 (patch) | |
tree | f6528235dce77db514ce4442ee8817e993fdcc86 /pkg/config/feed.go | |
parent | d21881150c09986571a563eaf30bc1687787e63f (diff) | |
download | feed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.tar.gz feed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.tar.bz2 feed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.zip |
Larger restructuring
Diffstat (limited to '')
-rw-r--r-- | pkg/config/feed.go | 38 |
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() +} |