Improve kubectl help with examples.

This commit is contained in:
Phillip Wittrock
2017-01-06 12:05:08 -08:00
parent 8ef6902516
commit dc2fffe5d4
10 changed files with 113 additions and 29 deletions

View File

@@ -22,14 +22,23 @@ import (
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/version"
)
var (
version_example = templates.Examples(`
# Print the client and server versions for the current context
kubectl version`)
)
func NewCmdVersion(f cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the client and server version information",
Use: "version",
Short: "Print the client and server version information",
Long: "Print the client and server version information for the current context",
Example: version_example,
Run: func(cmd *cobra.Command, args []string) {
err := RunVersion(f, out, cmd)
cmdutil.CheckErr(err)