Example #1
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	cmd := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, os.Stdout, os.Stderr)
	if err := cmd.Execute(); err != nil {
		os.Exit(1)
	}
}
Example #2
0
func main() {
	cmd := cmd.NewFactory().NewKubectlCommand(os.Stdout)
	if err := cmd.Execute(); err != nil {
		glog.Errorf("error: %v", err)
		os.Exit(1)
	}
}
func main() {
	out := os.Stdout
	// Set environment variables used by kubectl so the output is consistent,
	// regardless of where we run.
	os.Setenv("HOME", "/home/username")
	kubectl := cmd.NewFactory().NewKubectlCommand(out)
	fmt.Fprintf(out, "## %s\n\n", kubectl.Name())
	fmt.Fprintf(out, "%s\n\n", kubectl.Short)
	fmt.Fprintln(out, "### Commands\n")
	for _, c := range kubectl.Commands() {
		genMarkdown(c, nil, out)
	}
}
Example #4
0
func main() {
	// use os.Args instead of "flags" because "flags" will mess up the man pages!
	docsDir := "docs/man/man1/"
	if len(os.Args) == 2 {
		docsDir = os.Args[1]
	} else if len(os.Args) > 2 {
		fmt.Fprintf(os.Stderr, "usage: %s [output directory]\n", os.Args[0])
		os.Exit(1)
	}

	docsDir, err := filepath.Abs(docsDir)
	if err != nil {
		fmt.Fprintf(os.Stderr, err.Error())
		os.Exit(1)
	}

	stat, err := os.Stat(docsDir)
	if err != nil {
		fmt.Fprintf(os.Stderr, "output directory %s does not exist\n", docsDir)
		os.Exit(1)
	}

	if !stat.IsDir() {
		fmt.Fprintf(os.Stderr, "output directory %s is not a directory\n", docsDir)
		os.Exit(1)
	}
	docsDir = docsDir + "/"

	// 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.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard)
	genMarkdown(kubectl, "", docsDir)
	for _, c := range kubectl.Commands() {
		genMarkdown(c, "kubectl", docsDir)
	}
}
Example #5
0
func main() {
	cmd.NewFactory().Run(os.Stdout)
}
Example #6
0
func main() {
	cmd := cmd.NewFactory().NewKubectlCommand(os.Stdout)
	if err := cmd.Execute(); err != nil {
		os.Exit(1)
	}
}