aboutsummaryrefslogtreecommitdiff
path: root/main.go
blob: c155a1b3424b0ae0ba5e099d02d8109334fb01a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"flag"
	"log"
	"os"

	"github.com/Necoro/feed2imap-go/internal/config"
	"github.com/Necoro/feed2imap-go/internal/parse"
	"github.com/Necoro/feed2imap-go/internal/util"
)

var cfgFile = flag.String("f", "config.yml", "configuration file")

func run() error {
	log.Print("Starting up...")
	flag.Parse()

	log.Printf("Reading configuration file '%s'", *cfgFile)
	cfg, err := config.Load(*cfgFile)
	if err != nil {
		return err
	}

	parse.Parse(cfg.Feeds)

	return nil
}

func main() {
	if err := run(); err != nil {
		util.Error(err)
		os.Exit(1)
	}
}