aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.yml.example4
-rw-r--r--pkg/config/yaml.go10
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
+ }
}
}