-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (41 loc) · 856 Bytes
/
main.go
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
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"log"
"os"
"time"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "rssarchiver",
Usage: "Back up for RSS/ATOM feeds",
ArgsUsage: "opml_file.xml",
Action: func(c *cli.Context) error {
if c.NArg() < 1 {
return cli.ShowAppHelp(c)
}
return NewArchiver().UpdateFromOPML(c.Args().First())
},
Commands: []*cli.Command{
{
Name: "summary",
Usage: "Generate feed summary for a date",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "date",
Aliases: []string{"d"},
Value: time.Now().Format("2006-01-02"),
Usage: "Date for the summary",
},
},
Action: func(c *cli.Context) error {
return NewArchiver().GenerateSummary(c.String("date"))
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}