-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
55 lines (47 loc) · 998 Bytes
/
Copy pathmain.go
File metadata and controls
55 lines (47 loc) · 998 Bytes
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
package main
import (
"log"
"os"
"github.com/jakolehm/trieres/cmd"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
// Version gets overridden at build time using -X main.Version=$VERSION
var (
Version = "dev"
)
func init() {
logrus.SetOutput(os.Stdout)
logrus.SetLevel(logrus.InfoLevel)
customFormatter := new(logrus.TextFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.FullTimestamp = true
logrus.SetFormatter(customFormatter)
}
func main() {
app := &cli.App{
Name: "trieres",
Version: Version,
Usage: "k3s cluster lifecycle management tool",
Commands: []*cli.Command{
cmd.UpCommand(),
cmd.KubeconfigCommand(),
},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "debug,d",
Usage: "Debug logging",
},
},
Before: func(ctx *cli.Context) error {
if ctx.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}