-
Notifications
You must be signed in to change notification settings - Fork 32
/
mkr.go
41 lines (36 loc) · 864 Bytes
/
mkr.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
package main
import (
"fmt"
"os"
"runtime"
"github.com/mackerelio/mackerel-agent/config"
"github.com/mackerelio/mkr/logger"
"gopkg.in/urfave/cli.v1"
)
func main() {
app := cli.NewApp()
app.Name = "mkr"
app.Version = fmt.Sprintf("%s (rev:%s)", version, gitcommit)
app.Usage = "A CLI tool for mackerel.io"
app.Author = "Hatena Co., Ltd."
app.Commands = Commands
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "conf",
Value: config.DefaultConfig.Conffile,
Usage: "Config file path",
},
cli.StringFlag{
Name: "apibase",
// this default value is set in config.LoadApibaseFromConfigWithFallback
Usage: fmt.Sprintf("API Base (default: \"%s\")", config.DefaultConfig.Apibase),
},
}
cpu := runtime.NumCPU()
runtime.GOMAXPROCS(cpu)
err := app.Run(os.Args)
if err != nil {
logger.Log("error", err.Error())
os.Exit(1)
}
}