k3s/pkg/cli/cmds/root.go
2020-07-10 10:34:00 -07:00

31 lines
631 B
Go

package cmds
import (
"fmt"
"os"
"github.com/rancher/k3s/pkg/version"
"github.com/rancher/spur/cli"
)
func init() {
// hack - force "file,dns" lookup order if go dns is used
if os.Getenv("RES_OPTIONS") == "" {
os.Setenv("RES_OPTIONS", " ")
}
}
func NewApp() *cli.App {
app := cli.NewApp()
app.Name = appName
app.Usage = "Kubernetes, but small and simple"
app.Version = fmt.Sprintf("%s (%s)", version.Version, version.GitCommit)
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("%s version %s\n", app.Name, app.Version)
}
app.Flags = []cli.Flag{&DebugFlag}
app.Before = DebugContext(nil)
return app
}