forked from Azure/azapi-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (47 loc) · 976 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
50
51
52
53
54
55
package main
import (
"os"
"github.com/mitchellh/cli"
"github.com/Azure/azapi-lsp/internal/cmd"
)
func main() {
c := &cli.CLI{
Name: "azapi-lsp",
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{
"completion": func() (cli.Command, error) {
return &cmd.CompletionCommand{
Ui: ui,
}, nil
},
"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)
}