forked from cloudfoundry-incubator/fissile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (39 loc) · 877 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
package main
import (
"os"
"runtime"
"github.com/SUSE/fissile/app"
"github.com/SUSE/fissile/cmd"
"github.com/SUSE/termui"
"github.com/SUSE/termui/sigint"
"github.com/fatih/color"
)
var version = "0"
func main() {
var ui *termui.UI
if runtime.GOOS == "windows" {
ui = termui.New(
os.Stdin,
color.Output,
nil,
)
} else {
ui = termui.New(
os.Stdin,
os.Stdout,
nil,
)
}
switch {
case version == "":
ui.Println(color.RedString("Fissile was built incorrectly and its version string is empty."))
sigint.DefaultHandler.Exit(1)
case version == "0":
ui.Println(color.RedString("Fissile was built incorrectly and it doesn't have a proper version string."))
}
f := app.NewFissileApplication(version, ui)
if err := cmd.Execute(f, version); err != nil {
ui.Println(color.RedString("%v", err))
sigint.DefaultHandler.Exit(1)
}
}