aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 17:48:57 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-01 17:48:57 +0200
commit8afa4a29d793e84007666083158e198cf2b8557d (patch)
tree3ed60577657f2723e1cae80c3965b1414124f433 /pkg
parent23c2296ae94bedd616bffdf6f87f689bdc90b108 (diff)
downloadfeed2imap-go-8afa4a29d793e84007666083158e198cf2b8557d.tar.gz
feed2imap-go-8afa4a29d793e84007666083158e198cf2b8557d.tar.bz2
feed2imap-go-8afa4a29d793e84007666083158e198cf2b8557d.zip
Print warning, when unknown global option. Also support specifying the new 'options:' keys on global level, but print warning.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/yaml.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/config/yaml.go b/pkg/config/yaml.go
index f6b9edd..e8dc401 100644
--- a/pkg/config/yaml.go
+++ b/pkg/config/yaml.go
@@ -76,6 +76,27 @@ func unmarshal(in io.Reader, cfg *Config) (config, error) {
return parsedCfg, nil
}
+func (cfg *Config) fixGlobalOptions(unparsed Map) {
+ origMap := Map{}
+
+ // copy map
+ for k, v := range unparsed {
+ origMap[k] = v
+ }
+
+ newOpts, _ := buildOptions(&cfg.FeedOptions, unparsed)
+
+ for k := range origMap {
+ if _, ok := unparsed[k]; !ok {
+ log.Warnf("Global option '%s' should be inside the 'options' map. It currently overwrites the same key there.", k)
+ } else {
+ log.Warnf("Unknown global option '%s'. Ignored!", k)
+ }
+ }
+
+ cfg.FeedOptions = newOpts
+}
+
func (cfg *Config) parse(in io.Reader) error {
var (
err error
@@ -93,6 +114,8 @@ func (cfg *Config) parse(in io.Reader) error {
return fmt.Errorf("while unmarshalling: %w", err)
}
+ cfg.fixGlobalOptions(parsedCfg.GlobalConfig)
+
if err := buildFeeds(parsedCfg.Feeds, []string{}, cfg.Feeds, &cfg.FeedOptions); err != nil {
return fmt.Errorf("while parsing: %w", err)
}
session.py?h=v0.14.1&id=f9a4a36b341b1d866269f568e86cbf63b90b5f63&follow=1'> r609@Devoty: necoro | 2008-01-14 17:04:38 +0100Necoro9-394/+477 Allowed '-' and '_' in key names. Also use group names instead of their number. r610@Devoty: necoro | 2008-01-14 17:05:42 +0100 Disabled saving of the queues r611@Devoty: necoro | 2008-01-14 17:08:53 +0100 Added the possibility to permanently en-/disable plugins r612@Devoty: necoro | 2008-01-14 17:14:09 +0100 adjust changelog and translations r613@Devoty: necoro | 2008-01-14 17:40:53 +0100 Dropdown should be localized too 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 Updated shm module to version 1.1.4 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 Improved 'update world'; really support new use defaults 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 Handle the new useflag format correctly 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 updated todo 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 Re-Introduced etc-proposals 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 Disabled catapult till it is really usable 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 Fixed desktop file 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108 Added scrollbars to update window