diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-05-10 16:14:10 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-05-10 16:14:10 +0200 |
commit | 26c4cd410eee27c6e5764d991d3f495635c87faf (patch) | |
tree | 7bf641aae127313bf7e2310cef630d79ff2115a6 | |
parent | 3fb920705fe13e30c791bad030da17ba84e4ee0a (diff) | |
download | feed2imap-go-26c4cd410eee27c6e5764d991d3f495635c87faf.tar.gz feed2imap-go-26c4cd410eee27c6e5764d991d3f495635c87faf.tar.bz2 feed2imap-go-26c4cd410eee27c6e5764d991d3f495635c87faf.zip |
Allow options on group level.
Closes #12.
Diffstat (limited to '')
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | config.yml.example | 4 | ||||
-rw-r--r-- | pkg/config/yaml.go | 10 |
3 files changed, 11 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fc8e09a..0fc5c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Options are now also allowed on group-level (closes #12) ## [0.2.0] - 2020-05-10 diff --git a/config.yml.example b/config.yml.example index ef78d70..14f413e 100644 --- a/config.yml.example +++ b/config.yml.example @@ -24,7 +24,7 @@ parts: ["text", "html"] default-email: username@hostname ## Per-Feed Options -# Defaults for options per feed, overridable in each feed +# Defaults for options per feed, overridable in each feed and group # NB: For compatibility with old feed2imap, options existing in feed2imap can also be specified at the toplevel, # i.e. not beneath 'options'. Triggers a warning though :) options: @@ -72,6 +72,8 @@ feeds: min-frequency: 12 # Groups can be used for, well, grouping. - group: Linux + # You can specify options on group level that are then used for all feeds contained + min-frequency: 6 feeds: - name: Arch Linux # Use `target` to specify the folder name. diff --git a/pkg/config/yaml.go b/pkg/config/yaml.go index 66f099a..853fb96 100644 --- a/pkg/config/yaml.go +++ b/pkg/config/yaml.go @@ -216,13 +216,15 @@ func buildFeeds(cfg []configGroupFeed, target []string, feeds Feeds, globalFeedO } case f.isGroup(): - if err := buildFeeds(f.Group.Feeds, target, feeds, globalFeedOptions); err != nil { - return err - } + opt, unknown := buildOptions(globalFeedOptions, f.Options) - for optName := range f.Options { + for _, optName := range unknown { log.Warnf("Unknown option '%s' for group '%s'. Ignored!", optName, f.Group.Group) } + + if err := buildFeeds(f.Group.Feeds, target, feeds, &opt); err != nil { + return err + } } } |