-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
28 lines (22 loc) · 614 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
package main
import (
"os"
"github.com/tlhunter/mig/commands"
"github.com/tlhunter/mig/config"
"github.com/tlhunter/mig/result"
)
func main() {
cfg, subcommands, bail := config.GetConfig()
var res result.Response
if bail != nil && len(subcommands) == 0 {
res.SetError("usage: mig <command>", "command_usage")
} else if bail != nil && len(subcommands) == 1 && subcommands[0] == "version" {
res = commands.CommandVersion(cfg)
} else if bail != nil {
res = *bail
} else if bail == nil {
res = commands.Dispatch(cfg, subcommands)
}
res.Display(cfg.OutputJson)
os.Exit(int(res.ExitStatus))
}