aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-17 12:57:37 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-17 12:57:37 +0200
commit182338a22fdc5b02bf0d272b98daa4e4e6253fa2 (patch)
tree68fb0baae3ed64263c7ca2dc637b1fd512291a05 /main.go
downloadfeed2imap-go-182338a22fdc5b02bf0d272b98daa4e4e6253fa2.tar.gz
feed2imap-go-182338a22fdc5b02bf0d272b98daa4e4e6253fa2.tar.bz2
feed2imap-go-182338a22fdc5b02bf0d272b98daa4e4e6253fa2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--main.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..9f20203
--- /dev/null
+++ b/main.go
@@ -0,0 +1,54 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "log"
+
+ "gopkg.in/yaml.v2"
+)
+
+var cfg = flag.String("f", "config.yml", "configuration file")
+
+type ConfigMap map[string]interface{}
+
+type Feed struct {
+ Name string
+ Url string
+ MinFreq int `yaml:"min-frequency"`
+ ConfigMap `yaml:",inline"`
+}
+
+type Group struct {
+ Group string
+ Feeds []GroupFeed
+}
+
+type GroupFeed struct {
+ Target string
+ Feed `yaml:",inline"`
+ Group `yaml:",inline"`
+}
+
+type Yaml struct {
+ GlobalConfig ConfigMap `yaml:",inline"`
+ Feeds []GroupFeed
+}
+
+func main() {
+ log.Print("Starting up...")
+ flag.Parse()
+
+ log.Printf("Reading configuration file '%s'", *cfg)
+ buf, err := ioutil.ReadFile(*cfg)
+ if err != nil {
+ msg := fmt.Sprint("No file found: ", *cfg)
+ panic(msg)
+ }
+
+ var m Yaml
+ yaml.Unmarshal(buf, &m)
+ fmt.Printf("--- m:\n%+v\n\n", m)
+
+}
/src/password-store.sh?id=24c535e41b71cf6fdc22216b3c4196264e247880&follow=1'>show: error out if password store is empty.Jason A. Donenfeld1-1/+4 2014-04-24find: proper segmenting of terms1.6Jason A. Donenfeld1-3/+3 2014-04-24dmenu: hide outputJason A. Donenfeld1-1/+1 2014-04-24tests: test for spacesJason A. Donenfeld3-8/+20 2014-04-24Move test instructions to INSTALL.Jason A. Donenfeld2-11/+18 2014-04-24tests: we don't use aggregate-resultsJason A. Donenfeld1-57/+0 2014-04-24Don't prompt for questions when stdin is not a tty.Jason A. Donenfeld3-7/+6 2014-04-24Allow overridable bash.Jason A. Donenfeld16-16/+16 2014-04-24dmenu: check for empty instead of ret codeJason A. Donenfeld1-1/+1 2014-04-24tests: sed doesn't like escaped chars on non-gnuJason A. Donenfeld1-1/+1 2014-04-24tests: run from anywhereJason A. Donenfeld13-4/+16 2014-04-24Turns out aliases were a bad idea.Jason A. Donenfeld14-95/+92 2014-04-24Make gpg_opts an array.Jason A. Donenfeld1-12/+12 2014-04-24Shellcheck errors.Jason A. Donenfeld1-6/+6 2014-04-24tests: todo updateJason A. Donenfeld1-25/+0