-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
66 lines (53 loc) · 1.47 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Package main is the entry point for the application
package main
import (
"fmt"
"log"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/urfave/cli/v2"
"github.com/isabelroses/izrss/cmd"
"github.com/isabelroses/izrss/lib"
)
var version = "unstable"
func main() {
cli.AppHelpTemplate = fmt.Sprintf(`%s
CUSTOMIZATION:
The main bulk of customization is done via the "~/.config/izrss/config.toml" file. You can find an example file on the github page.
The rest of the config is done via using the environment variables "GLAMOUR_STYLE".
For a good example see: <https://github.com/catppuccin/glamour>`,
cli.AppHelpTemplate,
)
app := &cli.App{
Name: "izrss",
Version: version,
Authors: []*cli.Author{{
Name: "Isabel Roses",
Email: "isabel@isabelroses.com",
}},
Usage: "An RSS feed reader for the terminal.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Value: "",
Usage: "the path to your config file",
},
},
Action: func(c *cli.Context) error {
lib.LoadConfig(c.String("config"))
if len(lib.UserConfig.Urls) == 0 {
fmt.Println("No urls were found in config file, please add some and try again")
fmt.Println("You can find an example config file on the github page")
os.Exit(1)
}
p := tea.NewProgram(cmd.NewModel(), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
log.Fatal(err)
}
return nil
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}