-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (33 loc) · 767 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
package main
import (
"os"
"github.com/pivotal-cf/jhanda"
"github.com/williammartin/gomg/build"
"github.com/williammartin/gomg/ui"
"github.com/williammartin/gomg/validate"
)
type globalOptions struct{}
func main() {
UI := &ui.UI{
Out: os.Stdout,
Err: os.Stderr,
}
var globalOptions globalOptions
args, err := jhanda.Parse(&globalOptions, os.Args[1:])
if err != nil {
UI.DisplayErrorAndFailed(err)
os.Exit(1)
}
var command string
if len(args) > 0 {
command, args = args[0], args[1:]
}
commandSet := jhanda.CommandSet{}
commandSet["validate"] = validate.Command{}
commandSet["build"] = build.Command{}
if err := commandSet.Execute(command, args); err != nil {
UI.DisplayErrorAndFailed(err)
os.Exit(1)
}
UI.DisplaySuccess()
}