-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (41 loc) · 1.19 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
package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
ic "github.com/hortonworks/imagecatalog-cli/cli"
"github.com/urfave/cli"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "imagecatalog"
app.Usage = "Cli for cloudbreak imagecatalog handling"
app.Version = ic.Version + "-" + ic.BuildTime
app.Author = "Hortonworks\n\nLICENSE:" + `
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/`
app.Flags = []cli.Flag{
ic.FlDebug,
}
app.Before = func(c *cli.Context) error {
log.SetOutput(os.Stderr)
log.SetLevel(log.ErrorLevel)
formatter := &ic.LogFormatter{}
log.SetFormatter(formatter)
if c.Bool(ic.FlDebug.Name) {
log.SetLevel(log.DebugLevel)
}
return nil
}
app.Commands = []cli.Command{
{
Name: "addversion",
Description: fmt.Sprintf("add image information to the imagecatalog for the cloudbreak / ambari / hdp version triplet"),
Usage: "add image information to the imagecatalog for the cloudbreak / ambari / hdp version triplet",
Flags: []cli.Flag{ic.FlImageCatalog, ic.FlOutputImageCatalog, ic.FlCloudbreakVersion, ic.FlAmbariVersion, ic.FlHdpVersion},
Action: ic.AddVersion,
},
}
app.Run(os.Args)
}