-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (42 loc) · 867 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
43
44
45
46
47
48
49
package main
import (
"os"
"github.com/mitchellh/cli"
"github.com/tomhjp/vault-ls/internal/cmd"
)
func main() {
c := &cli.CLI{
Name: "vault-ls",
Version: VersionString(),
Args: os.Args[1:],
HelpWriter: os.Stdout,
}
ui := &cli.ColoredUi{
ErrorColor: cli.UiColorRed,
WarnColor: cli.UiColorYellow,
Ui: &cli.BasicUi{
Writer: os.Stdout,
Reader: os.Stdin,
ErrorWriter: os.Stderr,
},
}
c.Commands = map[string]cli.CommandFactory{
"serve": func() (cli.Command, error) {
return &cmd.ServeCommand{
Ui: ui,
Version: VersionString(),
}, nil
},
"version": func() (cli.Command, error) {
return &cmd.VersionCommand{
Ui: ui,
Version: VersionString(),
}, nil
},
}
exitStatus, err := c.Run()
if err != nil {
ui.Error("Error: " + err.Error())
}
os.Exit(exitStatus)
}