forked from kohey18/kangol
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
99 lines (90 loc) · 1.86 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package main
import (
"os"
"github.com/codegangsta/cli"
)
func main() {
finished := make(chan bool)
go loading(finished)
app := cli.NewApp()
app.Name = "kangol"
app.Version = "0.2.8"
app.Usage = "ECS deployment tool"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "conf",
Value: "",
Usage: "ECS service family at task definition",
},
cli.StringFlag{
Name: "tag",
Value: "",
Usage: "--tag has a container tag",
},
cli.BoolFlag{
Name: "debug",
Usage: "--debug has a debug mode",
},
cli.BoolFlag{
Name: "skip-polling",
Usage: "--skip-polling skip polling",
},
cli.BoolFlag{
Name: "loading",
Usage: "--loading has a loading while deploying",
},
cli.Int64Flag{
Name: "polling-time",
Value: 1,
Usage: "--polling-time 10",
},
}
app.Action = func(c *cli.Context) {
if c.Bool("loading") == false {
finished <- true
}
deploy(
c.String("conf"),
c.String("tag"),
c.Bool("debug"),
c.Bool("skip-polling"),
c.Int64("polling-time"))
}
app.Commands = []cli.Command{
{
Name: "run",
Usage: "run an ECS task",
Flags: []cli.Flag{
cli.StringFlag{
Name: "conf",
Value: "",
Usage: "ECS service family at task definition",
},
cli.StringFlag{
Name: "tag",
Value: "",
Usage: "--tag has a container tag",
},
cli.StringFlag{
Name: "command",
Value: "",
Usage: "--command has a run task override command",
},
cli.Int64Flag{
Name: "cpu",
Value: 256,
Usage: "--cpu has a run task override cpu reserved",
},
cli.Int64Flag{
Name: "memory",
Value: 256,
Usage: "--memory has a run task override memory reserved",
},
},
Action: func(c *cli.Context) {
runTask(c.String("conf"), c.String("tag"), c.String("command"), c.Int64("cpu"), c.Int64("memory"))
},
},
}
app.Run(os.Args)
}