-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.go
86 lines (80 loc) · 1.76 KB
/
cli.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
package control
import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/rancher/os/config"
)
func Main() {
app := cli.NewApp()
app.Name = os.Args[0]
app.Usage = "Control and configure RancherOS"
app.Version = config.VERSION
app.Author = "Rancher Labs, Inc."
app.EnableBashCompletion = true
app.Before = func(c *cli.Context) error {
if os.Geteuid() != 0 {
log.Fatalf("%s: Need to be root", os.Args[0])
}
return nil
}
app.Commands = []cli.Command{
{
Name: "config",
ShortName: "c",
Usage: "configure settings",
HideHelp: true,
Subcommands: configSubcommands(),
},
{
Name: "console",
Usage: "manage which console container is used",
HideHelp: true,
Subcommands: consoleSubcommands(),
},
{
Name: "dev",
ShortName: "d",
Usage: "dev spec",
HideHelp: true,
SkipFlagParsing: true,
Action: devAction,
},
{
Name: "engine",
Usage: "manage which Docker engine is used",
HideHelp: true,
Subcommands: engineSubcommands(),
},
{
Name: "entrypoint",
HideHelp: true,
SkipFlagParsing: true,
Action: entrypointAction,
},
{
Name: "env",
ShortName: "e",
Usage: "env command",
HideHelp: true,
SkipFlagParsing: true,
Action: envAction,
},
serviceCommand(),
{
Name: "os",
Usage: "operating system upgrade/downgrade",
HideHelp: true,
Subcommands: osSubcommands(),
},
{
Name: "tls",
Usage: "setup tls configuration",
HideHelp: true,
Subcommands: tlsConfCommands(),
},
installCommand,
selinuxCommand(),
}
app.Run(os.Args)
}