1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 15:06:23 +00:00
Files
rke/main.go

58 lines
1.3 KiB
Go
Raw Normal View History

2017-10-25 17:02:49 -07:00
package main
import (
"os"
"regexp"
2017-10-25 17:02:49 -07:00
"github.com/mattn/go-colorable"
2017-10-29 11:45:21 +02:00
"github.com/rancher/rke/cmd"
2017-11-13 23:28:38 +02:00
"github.com/sirupsen/logrus"
2017-10-25 17:02:49 -07:00
"github.com/urfave/cli"
)
2018-01-15 23:35:31 +02:00
var VERSION = "v0.0.12-dev"
var released = regexp.MustCompile(`^v[0-9]+\.[0-9]+\.[0-9]+$`)
2017-10-25 17:02:49 -07:00
func main() {
logrus.SetOutput(colorable.NewColorableStdout())
if err := mainErr(); err != nil {
logrus.Fatal(err)
}
}
func mainErr() error {
2017-10-25 17:02:49 -07:00
app := cli.NewApp()
app.Name = "rke"
app.Version = VERSION
app.Usage = "Rancher Kubernetes Engine, an extremely simple, lightning fast Kubernetes installer that works everywhere"
2017-10-29 11:45:21 +02:00
app.Before = func(ctx *cli.Context) error {
if ctx.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
logrus.Debugf("RKE version %s", app.Version)
if released.MatchString(app.Version) {
return nil
}
logrus.Warnf("This is not an officially supported version (%s) of RKE. Please download the latest official release at https://github.com/rancher/rke/releases/latest", app.Version)
2017-10-25 17:02:49 -07:00
return nil
}
2017-10-29 11:45:21 +02:00
app.Author = "Rancher Labs, Inc."
app.Email = ""
app.Commands = []cli.Command{
cmd.UpCommand(),
cmd.RemoveCommand(),
cmd.VersionCommand(),
cmd.ConfigCommand(),
2018-05-09 19:39:19 +02:00
cmd.EtcdCommand(),
2018-08-20 06:37:04 +02:00
cmd.CertificateCommand(),
2017-10-29 11:45:21 +02:00
}
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug,d",
Usage: "Debug logging",
},
}
return app.Run(os.Args)
2017-10-25 17:02:49 -07:00
}