aboutsummaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/config/config.go6
-rw-r--r--pkg/config/deprecated.go2
-rw-r--r--pkg/config/feed.go1
-rw-r--r--pkg/config/yaml.go4
-rw-r--r--pkg/config/yaml_test.go19
5 files changed, 30 insertions, 2 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index bd3927c..e98a1aa 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -83,6 +83,12 @@ func (cfg *Config) Validate() error {
return fmt.Errorf("No target set!")
}
+ for _, feed := range cfg.Feeds {
+ if feed.Url != "" && len(feed.Exec) > 0 {
+ return fmt.Errorf("Feed %s: Both 'Url' and 'Exec' set, unsure what to do.", feed.Name)
+ }
+ }
+
return nil
}
diff --git a/pkg/config/deprecated.go b/pkg/config/deprecated.go
index 9fb8b6e..becc9fb 100644
--- a/pkg/config/deprecated.go
+++ b/pkg/config/deprecated.go
@@ -19,7 +19,7 @@ var unsupported = deprecated{
var deprecatedOpts = map[string]deprecated{
"dumpdir": unsupported,
"debug-updated": {"Use '-d' as option instead.", nil},
- "execurl": unsupported,
+ "execurl": {"Use 'exec' instead.", nil},
"filter": {"Use 'item-filter' instead.", nil},
"disable-ssl-verification": {"Interpreted as 'tls-no-verify'.", func(i interface{}, global *GlobalOptions, opts *Options) {
val, ok := i.(bool)
diff --git a/pkg/config/feed.go b/pkg/config/feed.go
index e6788d2..93d67cc 100644
--- a/pkg/config/feed.go
+++ b/pkg/config/feed.go
@@ -5,6 +5,7 @@ type Feed struct {
Name string
Target []string
Url string
+ Exec []string
Options
}
diff --git a/pkg/config/yaml.go b/pkg/config/yaml.go
index 853fb96..85b6bd0 100644
--- a/pkg/config/yaml.go
+++ b/pkg/config/yaml.go
@@ -32,6 +32,7 @@ type group struct {
type feed struct {
Name string
Url string
+ Exec []string
}
type configGroupFeed struct {
@@ -46,7 +47,7 @@ func (grpFeed *configGroupFeed) isGroup() bool {
}
func (grpFeed *configGroupFeed) isFeed() bool {
- return grpFeed.Feed.Name != "" || grpFeed.Feed.Url != ""
+ return grpFeed.Feed.Name != "" || grpFeed.Feed.Url != "" || len(grpFeed.Feed.Exec) > 0
}
func (grpFeed *configGroupFeed) target() string {
@@ -211,6 +212,7 @@ func buildFeeds(cfg []configGroupFeed, target []string, feeds Feeds, globalFeedO
feeds[name] = &Feed{
Name: name,
Url: f.Feed.Url,
+ Exec: f.Feed.Exec,
Options: opt,
Target: target,
}
diff --git a/pkg/config/yaml_test.go b/pkg/config/yaml_test.go
index a3254d5..fdc5e80 100644
--- a/pkg/config/yaml_test.go
+++ b/pkg/config/yaml_test.go
@@ -234,6 +234,25 @@ feeds:
Options: Map{"include-images": true, "unknown-option": "foo"},
}}, Map{"something": 1})},
+ {name: "Feed with Exec",
+ inp: `
+feeds:
+ - name: Foo
+ exec: [whatever, -i, http://foo.bar]
+ target: bar
+ include-images: true
+ unknown-option: foo
+`,
+ wantErr: false,
+ config: defaultConfig([]configGroupFeed{{
+ Target: n("bar"),
+ Feed: feed{
+ Name: "Foo",
+ Exec: []string{"whatever", "-i", "http://foo.bar"},
+ },
+ Options: Map{"include-images": true, "unknown-option": "foo"},
+ }}, nil)},
+
{name: "Feeds",
inp: `
feeds: