-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprout.go
49 lines (47 loc) · 1.06 KB
/
sprout.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 (
"github.com/codegangsta/cli"
"github.com/codeskyblue/go-sh"
"github.com/golang/glog"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "boom"
app.Usage = "make an explosive entrance"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
},
}
app.Action = func(c *cli.Context) {
name := "someone"
if len(c.Args()) > 0 {
name = c.Args()[0]
}
if c.String("lang") == "spanish" {
println("Hola", name)
} else {
println("Hello", name)
}
sh.Command("echo", "hello").Run()
}
app.Commands = []cli.Command{
{
Name: "create",
ShortName: "c",
Usage: "create a new application",
Action: func(c *cli.Context) {
println("Creating application")
if len(c.Args()) > 0 {
application := c.Args()[0]
sh.Command("aws", "elasticbeanstalk", "create-application", "--application-name", application).Run()
glog.Info("sh: aws elasticbeanstalk create-application --application-name", application)
}
},
},
}
app.Run(os.Args)
}