-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (35 loc) · 778 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
package main
import (
logpkg "log"
"os"
"runtime/debug"
"github.com/mitchellh/cli"
"github.com/nathanejohnson/whichca/cmd"
)
var version = ""
func main() {
log := logpkg.New(os.Stdout, "", 0)
bi, ok := debug.ReadBuildInfo()
if ok && version == "" {
version = bi.Main.Version
}
c := cli.NewCLI(os.Args[0], version)
c.Commands = map[string]cli.CommandFactory{
"minca": func() (cli.Command, error) {
return cmd.NewMinCACmd(), nil
},
"check": func() (cli.Command, error) {
return cmd.NewCheckIntermediateCmd(), nil
},
"fetchca": func() (cli.Command, error) {
return cmd.NewFetchCACmd(), nil
},
}
systemSpecificCmds(c.Commands)
c.Args = os.Args[1:]
errno, err := c.Run()
if err != nil {
log.Printf("Error: %s", err)
}
os.Exit(errno)
}