-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (44 loc) · 1.12 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
package main
import (
"github.com/fatih/color"
"github.com/mitchellh/cli"
trellisCmd "github.com/roots/trellis-cli/cmd"
"github.com/roots/trellis-cli/trellis"
"os"
"github.com/ItinerisLtd/trellis-cli-kinsta/cmd"
)
var version = "canary"
func main() {
c := cli.NewCLI("trellis-kinsta", version)
c.Args = os.Args[1:]
ui := &cli.ColoredUi{
ErrorColor: cli.UiColorRed,
WarnColor: cli.UiColor{Code: int(color.FgYellow), Bold: false},
Ui: &cli.BasicUi{
Reader: os.Stdin,
Writer: os.Stdout,
ErrorWriter: os.Stderr,
},
}
trellis := trellis.NewTrellis()
if err := trellis.LoadGlobalCliConfig(); err != nil {
ui.Error(err.Error())
os.Exit(1)
}
c.Commands = map[string]cli.CommandFactory{
"site": func() (cli.Command, error) {
return &trellisCmd.NamespaceCommand{
HelpText: "Usage: trellis kinsta site <subcommand> [<args>]",
SynopsisText: "Manage your Kinsta sites",
}, nil
},
"site list": func() (cli.Command, error) {
return cmd.NewSiteListCommand(ui, trellis), nil
},
}
exitStatus, err := c.Run()
if err != nil {
ui.Error(err.Error())
}
os.Exit(exitStatus)
}