k3s/pkg/cli/cmds/root.go

31 lines
631 B
Go
Raw Normal View History

2019-01-09 16:54:15 +00:00
package cmds
import (
"fmt"
2019-11-12 04:20:19 +00:00
"os"
2019-01-09 16:54:15 +00:00
"github.com/rancher/k3s/pkg/version"
2020-07-10 17:34:00 +00:00
"github.com/rancher/spur/cli"
2019-01-09 16:54:15 +00:00
)
2019-11-12 04:20:19 +00:00
func init() {
// hack - force "file,dns" lookup order if go dns is used
if os.Getenv("RES_OPTIONS") == "" {
os.Setenv("RES_OPTIONS", " ")
}
}
2019-01-09 16:54:15 +00:00
func NewApp() *cli.App {
app := cli.NewApp()
app.Name = appName
app.Usage = "Kubernetes, but small and simple"
2019-02-08 04:28:09 +00:00
app.Version = fmt.Sprintf("%s (%s)", version.Version, version.GitCommit)
2019-01-09 16:54:15 +00:00
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s version %s\n", app.Name, app.Version)
}
2020-07-10 17:34:00 +00:00
app.Flags = []cli.Flag{&DebugFlag}
app.Before = DebugContext(nil)
2019-01-09 16:54:15 +00:00
return app
}