func main() { runtime.GOMAXPROCS(runtime.NumCPU()) cmd := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr) if err := cmd.Execute(); err != nil { os.Exit(1) } }
func main() { // use os.Args instead of "flags" because "flags" will mess up the man pages! path := "docs/man/man1" if len(os.Args) == 2 { path = os.Args[1] } else if len(os.Args) > 2 { fmt.Fprintf(os.Stderr, "usage: %s [output directory]\n", os.Args[0]) os.Exit(1) } outDir, err := genutils.OutDir(path) if err != nil { fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err) os.Exit(1) } // Set environment variables used by kubectl so the output is consistent, // regardless of where we run. os.Setenv("HOME", "/home/username") //TODO os.Stdin should really be something like ioutil.Discard, but a Reader kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) genMarkdown(kubectl, "", outDir) for _, c := range kubectl.Commands() { genMarkdown(c, "kubectl", outDir) } }
func main() { // use os.Args instead of "flags" because "flags" will mess up the man pages! path := "contrib/completions/bash/" if len(os.Args) == 2 { path = os.Args[1] } else if len(os.Args) > 2 { fmt.Fprintf(os.Stderr, "usage: %s [output directory]\n", os.Args[0]) os.Exit(1) } outDir, err := genutils.OutDir(path) if err != nil { fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err) os.Exit(1) } outFile := outDir + "kubectl" //TODO os.Stdin should really be something like ioutil.Discard, but a Reader kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) kubectl.GenBashCompletionFile(outFile) }