-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (34 loc) · 709 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
package main
import (
"github.com/sirupsen/logrus"
"github.com/solvingj/envx/commands"
"github.com/solvingj/envx/system"
"os"
)
// Override at command-line with:
// go build -ldflags="-X main.Version=<SOMEVERSION>"
var Version = "dev"
func main() {
var log = logrus.New()
log.SetLevel(GetCliLogLevel())
err := execMain()
system.ExitOnErr(err)
}
func execMain() error {
app := commands.GetApp(Version)
args := os.Args
err := app.Run(args)
return err
}
func GetCliLogLevel() logrus.Level {
switch os.Getenv("ENVX_LOG_LEVEL") {
case "ERROR":
return logrus.ErrorLevel
case "WARN":
return logrus.WarnLevel
case "DEBUG":
return logrus.DebugLevel
default:
return logrus.InfoLevel
}
}