-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
59 lines (54 loc) · 1.09 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
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"github.com/lynxplay/carre/cmd"
"github.com/urfave/cli/v2"
"log"
"os"
"time"
)
var version string
func main() {
app := &cli.App{
Name: "carre",
Usage: "Docker process data point collection",
Version: getVersion(),
Action: cmd.Execute,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "container",
Aliases: []string{"C"},
Usage: "unique container name",
Required: true,
},
&cli.StringFlag{
Name: "format",
Aliases: []string{"F"},
Value: "JSON",
Usage: "output format of caree",
},
&cli.StringFlag{
Name: "timestamp",
Aliases: []string{"T"},
Value: "EPOCH",
Usage: "output format of the timestamps carre generates",
},
&cli.DurationFlag{
Name: "interval",
Aliases: []string{"I"},
Value: 500 * time.Millisecond,
Usage: "interval between data point collection",
},
},
}
app.EnableBashCompletion = true
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
func getVersion() string {
if version == "" {
return "develop"
}
return version
}