-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
51 lines (38 loc) · 925 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
47
48
49
50
51
package main
import (
"fmt"
"os"
"github.com/henrywhitaker3/prompage/cmd"
"github.com/henrywhitaker3/prompage/internal/app"
"github.com/henrywhitaker3/prompage/internal/config"
"github.com/henrywhitaker3/prompage/internal/querier"
"github.com/henrywhitaker3/prompage/internal/resources/views"
"github.com/spf13/pflag"
)
var (
configPath string
version string
)
//go:generate npm run build
func main() {
pflag.StringVarP(&configPath, "config", "c", "prompage.yaml", "The location of the config file")
root := cmd.NewRootCmd()
pflag.Parse()
conf, err := config.Load(configPath)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
qs, err := querier.BuildQueriers(conf.Datasources)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
app := app.NewApp(conf, qs)
app.Version = version
views.MustCompile()
cmd.LoadSubCommands(root, app)
if err := root.Execute(); err != nil {
os.Exit(2)
}
}