/
main.go
83 lines (77 loc) · 1.44 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
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/lotreal/docker-pods/src/pods"
)
func main() {
app := cli.NewApp()
app.Name = "docker-pods"
app.Usage = "manage your dockers"
app.Version = "0.0.1"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
},
}
app.Action = func(c *cli.Context) {
pods.Ps()
// println(c.String("lang"))
// name := "someone"
// if len(c.Args()) > 0 {
// name = c.Args()[0]
// }
// if c.String("lang") == "spanish" {
// println("Hola", name)
// } else {
// println("Hello", name)
// }
}
app.Commands = []cli.Command{
{
Name: "test",
Aliases: []string{"t"},
Usage: "test",
Flags: []cli.Flag{
cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
},
},
Action: func(c *cli.Context) {
fmt.Println(c.Bool("version"))
fmt.Println(c.String("lang"))
fmt.Println(c.Args().First())
},
},
{
Name: "ls",
Aliases: []string{"l"},
Usage: "list pods",
Action: func(c *cli.Context) {
// pods.List()
},
},
{
Name: "run",
Aliases: []string{"r"},
Usage: "docker run a pod",
Action: func(c *cli.Context) {
pods.Run()
},
},
{
Name: "status",
Aliases: []string{"ps"},
Usage: "list pods",
Action: func(c *cli.Context) {
pods.Ps()
},
},
}
app.Run(os.Args)
}