-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
53 lines (46 loc) · 911 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
package main
import (
"os"
"github.com/Azure/aztfmigrate/cmd"
"github.com/mitchellh/cli"
)
func main() {
c := &cli.CLI{
Name: "aztfmigrate",
Version: version,
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{
"migrate": func() (cli.Command, error) {
return &cmd.MigrateCommand{
Ui: ui,
}, nil
},
"plan": func() (cli.Command, error) {
return &cmd.PlanCommand{
Ui: ui,
}, nil
},
"version": func() (cli.Command, error) {
return &cmd.VersionCommand{
Ui: ui,
Version: version,
}, nil
},
}
exitStatus, err := c.Run()
if err != nil {
ui.Error("Error: " + err.Error())
}
os.Exit(exitStatus)
}