forked from jfrog/build-info-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (36 loc) · 756 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
package main
import (
"os"
"github.com/jfrog/build-info-go/cli"
"github.com/jfrog/build-info-go/utils"
clitool "github.com/urfave/cli/v2"
)
const logLevelEnv = "BUILD_INFO_LOG_LEVEL"
var log utils.Log
var cliVersion = "dev"
func main() {
log = utils.NewDefaultLogger(getCliLogLevel())
app := &clitool.App{
Name: "Build-Info CLI",
Usage: "Generate build-info for your source code",
Commands: cli.GetCommands(log),
Version: cliVersion,
}
err := app.Run(os.Args)
if err != nil {
log.Error(err)
os.Exit(1)
}
}
func getCliLogLevel() utils.LevelType {
switch os.Getenv(logLevelEnv) {
case "ERROR":
return utils.ERROR
case "WARN":
return utils.WARN
case "DEBUG":
return utils.DEBUG
default:
return utils.INFO
}
}