-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
94 lines (90 loc) · 1.81 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
package main
import (
"fmt"
"github.com/tmyksj/rlso11n/cmd/exec"
"github.com/tmyksj/rlso11n/cmd/serve"
"github.com/tmyksj/rlso11n/cmd/serve_rpc"
"github.com/tmyksj/rlso11n/cmd/up"
"github.com/urfave/cli/v2"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "rlso11n"
app.Usage = "manage engines in rootless mode"
app.Version = "0.1.1"
app.Commands = []*cli.Command{
{
Name: "exec",
Usage: "execute command",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "docker",
Usage: "execute docker command",
},
&cli.StringFlag{
Name: "nodes",
Usage: "nodes to use",
Value: "all",
},
&cli.StringFlag{
Name: "server",
Usage: "hostname or ip address to connect to",
Value: "0.0.0.0",
},
},
Action: exec.Action,
},
{
Name: "serve",
Usage: "start server at all nodes",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "dir",
Usage: "working directory to use",
},
&cli.StringFlag{
Name: "hostfile",
Usage: "hostfile to use",
},
&cli.StringFlag{
Name: "hosts",
Usage: "hostname or ip address of all nodes",
},
},
Action: serve.Action,
},
{
Name: "serve-rpc",
Usage: "start rpc server",
Hidden: true,
Action: serve_rpc.Action,
},
{
Name: "up",
Usage: "up engines",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "server",
Usage: "hostname or ip address to connect to",
Value: "0.0.0.0",
},
},
Subcommands: []*cli.Command{
{
Name: "dockerd",
Usage: "up docker daemon at all nodes",
Action: up.Dockerd,
},
{
Name: "swarm",
Usage: "up swarm cluster using all nodes",
Action: up.Swarm,
},
},
},
}
if err := app.Run(os.Args); err != nil {
_ = fmt.Errorf("failed to start rlso11n, %v", err)
}
}