From d75bbcf9a7fe589f119b103d357ffa874008ab07 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 2 May 2020 16:48:51 +0200 Subject: Option 'body' --- pkg/config/body.go | 35 +++++++++++++++++++++++++++++++++++ pkg/config/config.go | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 pkg/config/body.go (limited to 'pkg/config') diff --git a/pkg/config/body.go b/pkg/config/body.go new file mode 100644 index 0000000..d9957d5 --- /dev/null +++ b/pkg/config/body.go @@ -0,0 +1,35 @@ +package config + +import ( + "fmt" + + "gopkg.in/yaml.v3" + + "github.com/Necoro/feed2imap-go/pkg/util" +) + +type Body string + +var validBody = []string{"default", "both", "content", "description"} + +func (b *Body) UnmarshalYAML(node *yaml.Node) error { + var val string + if err := node.Decode(&val); err != nil { + return err + } + + if val == "" { + val = "default" + } + + if !util.StrContains(validBody, val) { + return TypeError("line %d: Invalid value for 'body': %q", node.Line, val) + } + + *b = Body(val) + return nil +} + +func TypeError(format string, v ...interface{}) *yaml.TypeError { + return &yaml.TypeError{Errors: []string{fmt.Sprintf(format, v...)}} +} diff --git a/pkg/config/config.go b/pkg/config/config.go index d1cd4c9..dfd3d0e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -44,10 +44,12 @@ type Options struct { IgnHash bool `yaml:"ignore-hash"` AlwaysNew bool `yaml:"always-new"` NoTLS bool `yaml:"tls-no-verify"` + Body Body `yaml:"body"` } // Default feed options var DefaultFeedOptions = Options{ + Body: "default", MinFreq: 1, InclImages: true, EmbedImages: false, -- cgit v1.2.3-54-g00ecf r
path: root/portato/TEST_helper.py (unfollow)
Commit message (Expand)AuthorFilesLines
2011-07-18Greek translation. Thanks to ilucidilucid2-0/+1223
2011-07-18POT-UpdateRené 'Necoro' Neumann1-346/+361
2010-09-06Update newsv0.14.10.14René 'Necoro' Neumann1-0/+7
2010-09-06Handle portage-2.1.8 and above as portage-2.2René 'Necoro' Neumann1-1/+1
2010-09-06Handle portage-2.1.9 and above as portage-2.2René 'Necoro' Neumann1-1/+1
2010-09-06Workaround for bug#557715René 'Necoro' Neumann1-1/+4
2010-09-06Gnah - changing portage-APIRené 'Necoro' Neumann1-2/+6
2010-09-04Fix system.split_cpvRené 'Necoro' Neumann1-1/+5
2010-07-06format strings need tuplesRené 'Necoro' Neumann1-1/+1
2010-05-25Do not bail out, if we try to replace stuff in a category w/o a dashRené 'Necoro' Neumann1-1/+7
2010-05-25Do not bail out, if we try to replace stuff in a category w/o a dashRené 'Necoro' Neumann1-1/+7
2010-05-22Update gtk-version in glade filesRené 'Necoro' Neumann8-8/+8
2010-05-22Fix the link buttonsRené 'Necoro' Neumann1-1/+1
2010-05-20Handle missing eix-cache file more gracefullyRené 'Necoro' Neumann1-0/+7
2010-05-20More declarative handling of the database typesRené 'Necoro' Neumann3-46/+59
2010-05-12Updated French translation to current code statusClement Bourgeois1-52/+56
2010-05-12Unused French translations purgedClement Bourgeois1-18/+0
2010-05-11Fix release script pathesv0.14René 'Necoro' Neumann1-1/+2
2010-05-11Add '--plugin-dir' optionRené 'Necoro' Neumann1-1/+9
2010-05-11Add a README message to the releaseRené 'Necoro' Neumann1-1/+14