Commit 1c715d51 authored by Di Xu's avatar Di Xu

some code change

fix wrong required flags disable the addition of [flags] to the usage, use customized useline fix function rename
parent 6c54ec59
...@@ -27,7 +27,7 @@ import ( ...@@ -27,7 +27,7 @@ import (
// MarkdownPostProcessing goes though the generated files // MarkdownPostProcessing goes though the generated files
func MarkdownPostProcessing(cmd *cobra.Command, dir string, processor func(string) string) error { func MarkdownPostProcessing(cmd *cobra.Command, dir string, processor func(string) string) error {
for _, c := range cmd.Commands() { for _, c := range cmd.Commands() {
if !c.IsAvailableCommand() || c.IsHelpCommand() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue continue
} }
if err := MarkdownPostProcessing(c, dir, processor); err != nil { if err := MarkdownPostProcessing(c, dir, processor); err != nil {
......
...@@ -111,7 +111,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command { ...@@ -111,7 +111,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
var ignorePreflightErrors []string var ignorePreflightErrors []string
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "join [flags]", Use: "join",
Short: "Run this on any machine you wish to join an existing cluster", Short: "Run this on any machine you wish to join an existing cluster",
Long: joinLongDescription, Long: joinLongDescription,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
......
...@@ -101,7 +101,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command { ...@@ -101,7 +101,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
var description string var description string
var printJoinCommand bool var printJoinCommand bool
createCmd := &cobra.Command{ createCmd := &cobra.Command{
Use: "create [token]", Use: "create [token]",
DisableFlagsInUseLine: true,
Short: "Create bootstrap tokens on the server.", Short: "Create bootstrap tokens on the server.",
Long: dedent.Dedent(` Long: dedent.Dedent(`
This command will create a bootstrap token for you. This command will create a bootstrap token for you.
...@@ -155,7 +156,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command { ...@@ -155,7 +156,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
tokenCmd.AddCommand(listCmd) tokenCmd.AddCommand(listCmd)
deleteCmd := &cobra.Command{ deleteCmd := &cobra.Command{
Use: "delete [token-value]", Use: "delete [token-value]",
DisableFlagsInUseLine: true,
Short: "Delete bootstrap tokens on the server.", Short: "Delete bootstrap tokens on the server.",
Long: dedent.Dedent(` Long: dedent.Dedent(`
This command will delete a given bootstrap token for you. This command will delete a given bootstrap token for you.
......
...@@ -69,7 +69,8 @@ func NewCmdApply(parentFlags *cmdUpgradeFlags) *cobra.Command { ...@@ -69,7 +69,8 @@ func NewCmdApply(parentFlags *cmdUpgradeFlags) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "apply [version]", Use: "apply [version]",
DisableFlagsInUseLine: true,
Short: "Upgrade your Kubernetes cluster to the specified version.", Short: "Upgrade your Kubernetes cluster to the specified version.",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
var err error var err error
......
...@@ -113,7 +113,8 @@ func NewCmdAnnotate(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -113,7 +113,8 @@ func NewCmdAnnotate(f cmdutil.Factory, out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]", Use: "annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
DisableFlagsInUseLine: true,
Short: i18n.T("Update the annotations on a resource"), Short: i18n.T("Update the annotations on a resource"),
Long: annotateLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Long: annotateLong + "\n\n" + cmdutil.ValidResourceTypeList(f),
Example: annotateExample, Example: annotateExample,
......
...@@ -105,7 +105,8 @@ func NewCmdApply(baseName string, f cmdutil.Factory, out, errOut io.Writer) *cob ...@@ -105,7 +105,8 @@ func NewCmdApply(baseName string, f cmdutil.Factory, out, errOut io.Writer) *cob
options.cmdBaseName = baseName options.cmdBaseName = baseName
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "apply -f FILENAME", Use: "apply -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Apply a configuration to a resource by filename or stdin"), Short: i18n.T("Apply a configuration to a resource by filename or stdin"),
Long: applyLong, Long: applyLong,
Example: applyExample, Example: applyExample,
......
...@@ -76,7 +76,8 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, out, errOut io.Writer) *cobra ...@@ -76,7 +76,8 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, out, errOut io.Writer) *cobra
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)", Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true,
Short: "Edit latest last-applied-configuration annotations of a resource/object", Short: "Edit latest last-applied-configuration annotations of a resource/object",
Long: applyEditLastAppliedLong, Long: applyEditLastAppliedLong,
Example: applyEditLastAppliedExample, Example: applyEditLastAppliedExample,
......
...@@ -84,7 +84,8 @@ var ( ...@@ -84,7 +84,8 @@ var (
func NewCmdApplySetLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command { func NewCmdApplySetLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
options := &SetLastAppliedOptions{Out: out, ErrOut: err} options := &SetLastAppliedOptions{Out: out, ErrOut: err}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set-last-applied -f FILENAME", Use: "set-last-applied -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Set the last-applied-configuration annotation on a live object to match the contents of a file."), Short: i18n.T("Set the last-applied-configuration annotation on a live object to match the contents of a file."),
Long: applySetLastAppliedLong, Long: applySetLastAppliedLong,
Example: applySetLastAppliedExample, Example: applySetLastAppliedExample,
......
...@@ -60,7 +60,8 @@ var ( ...@@ -60,7 +60,8 @@ var (
func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command { func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
options := &ViewLastAppliedOptions{Out: out, ErrOut: err} options := &ViewLastAppliedOptions{Out: out, ErrOut: err}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)", Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("View latest last-applied-configuration annotations of a resource/object"), Short: i18n.T("View latest last-applied-configuration annotations of a resource/object"),
Long: applyViewLastAppliedLong, Long: applyViewLastAppliedLong,
Example: applyViewLastAppliedExample, Example: applyViewLastAppliedExample,
......
...@@ -71,7 +71,8 @@ func NewCmdAttach(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) ...@@ -71,7 +71,8 @@ func NewCmdAttach(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer)
Attach: &DefaultRemoteAttach{}, Attach: &DefaultRemoteAttach{},
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "attach (POD | TYPE/NAME) -c CONTAINER", Use: "attach (POD | TYPE/NAME) -c CONTAINER",
DisableFlagsInUseLine: true,
Short: i18n.T("Attach to a running container"), Short: i18n.T("Attach to a running container"),
Long: "Attach to a process that is already running inside an existing container.", Long: "Attach to a process that is already running inside an existing container.",
Example: attachExample, Example: attachExample,
......
...@@ -88,7 +88,8 @@ func NewCmdCanI(f cmdutil.Factory, out, err io.Writer) *cobra.Command { ...@@ -88,7 +88,8 @@ func NewCmdCanI(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]", Use: "can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]",
DisableFlagsInUseLine: true,
Short: "Check whether an action is allowed", Short: "Check whether an action is allowed",
Long: canILong, Long: canILong,
Example: canIExample, Example: canIExample,
......
...@@ -64,7 +64,8 @@ func NewCmdReconcile(f cmdutil.Factory, out, err io.Writer) *cobra.Command { ...@@ -64,7 +64,8 @@ func NewCmdReconcile(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "reconcile -f FILENAME", Use: "reconcile -f FILENAME",
DisableFlagsInUseLine: true,
Short: "Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects", Short: "Reconciles rules for RBAC Role, RoleBinding, ClusterRole, and ClusterRole binding objects",
Long: reconcileLong, Long: reconcileLong,
Example: reconcileExample, Example: reconcileExample,
......
...@@ -52,7 +52,8 @@ func NewCmdAutoscale(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -52,7 +52,8 @@ func NewCmdAutoscale(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]", Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]",
DisableFlagsInUseLine: true,
Short: i18n.T("Auto-scale a Deployment, ReplicaSet, or ReplicationController"), Short: i18n.T("Auto-scale a Deployment, ReplicaSet, or ReplicationController"),
Long: autoscaleLong, Long: autoscaleLong,
Example: autoscaleExample, Example: autoscaleExample,
......
...@@ -32,7 +32,8 @@ import ( ...@@ -32,7 +32,8 @@ import (
func NewCmdCertificate(f cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdCertificate(f cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "certificate SUBCOMMAND", Use: "certificate SUBCOMMAND",
DisableFlagsInUseLine: true,
Short: i18n.T("Modify certificate resources."), Short: i18n.T("Modify certificate resources."),
Long: "Modify certificate resources.", Long: "Modify certificate resources.",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
...@@ -68,7 +69,8 @@ func (options *CertificateOptions) Validate() error { ...@@ -68,7 +69,8 @@ func (options *CertificateOptions) Validate() error {
func NewCmdCertificateApprove(f cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdCertificateApprove(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := CertificateOptions{} options := CertificateOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "approve (-f FILENAME | NAME)", Use: "approve (-f FILENAME | NAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("Approve a certificate signing request"), Short: i18n.T("Approve a certificate signing request"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Approve a certificate signing request. Approve a certificate signing request.
...@@ -118,7 +120,8 @@ func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out ...@@ -118,7 +120,8 @@ func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out
func NewCmdCertificateDeny(f cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdCertificateDeny(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := CertificateOptions{} options := CertificateOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "deny (-f FILENAME | NAME)", Use: "deny (-f FILENAME | NAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("Deny a certificate signing request"), Short: i18n.T("Deny a certificate signing request"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Deny a certificate signing request. Deny a certificate signing request.
......
...@@ -97,7 +97,8 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command { ...@@ -97,7 +97,8 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "completion SHELL", Use: "completion SHELL",
DisableFlagsInUseLine: true,
Short: i18n.T("Output shell completion code for the specified shell (bash or zsh)"), Short: i18n.T("Output shell completion code for the specified shell (bash or zsh)"),
Long: completion_long, Long: completion_long,
Example: completion_example, Example: completion_example,
......
...@@ -37,7 +37,8 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, out, er ...@@ -37,7 +37,8 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, out, er
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "config SUBCOMMAND", Use: "config SUBCOMMAND",
DisableFlagsInUseLine: true,
Short: i18n.T("Modify kubeconfig files"), Short: i18n.T("Modify kubeconfig files"),
Long: templates.LongDesc(` Long: templates.LongDesc(`
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context" Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"
......
...@@ -100,7 +100,8 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess) ...@@ -100,7 +100,8 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess)
func newCmdConfigSetAuthInfo(out io.Writer, options *createAuthInfoOptions) *cobra.Command { func newCmdConfigSetAuthInfo(out io.Writer, options *createAuthInfoOptions) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-credentials NAME [--%v=path/to/certfile] [--%v=path/to/keyfile] [--%v=bearer_token] [--%v=basic_user] [--%v=basic_password] [--%v=provider_name] [--%v=key=value]", clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword, flagAuthProvider, flagAuthProviderArg), Use: fmt.Sprintf("set-credentials NAME [--%v=path/to/certfile] [--%v=path/to/keyfile] [--%v=bearer_token] [--%v=basic_user] [--%v=basic_password] [--%v=provider_name] [--%v=key=value]", clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword, flagAuthProvider, flagAuthProviderArg),
DisableFlagsInUseLine: true,
Short: i18n.T("Sets a user entry in kubeconfig"), Short: i18n.T("Sets a user entry in kubeconfig"),
Long: create_authinfo_long, Long: create_authinfo_long,
Example: create_authinfo_example, Example: create_authinfo_example,
......
...@@ -63,7 +63,8 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess) ...@@ -63,7 +63,8 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &createClusterOptions{configAccess: configAccess} options := &createClusterOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]", clientcmd.FlagAPIServer, clientcmd.FlagCAFile, clientcmd.FlagInsecure), Use: fmt.Sprintf("set-cluster NAME [--%v=server] [--%v=path/to/certificate/authority] [--%v=true]", clientcmd.FlagAPIServer, clientcmd.FlagCAFile, clientcmd.FlagInsecure),
DisableFlagsInUseLine: true,
Short: i18n.T("Sets a cluster entry in kubeconfig"), Short: i18n.T("Sets a cluster entry in kubeconfig"),
Long: create_cluster_long, Long: create_cluster_long,
Example: create_cluster_example, Example: create_cluster_example,
......
...@@ -54,7 +54,8 @@ func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess) ...@@ -54,7 +54,8 @@ func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &createContextOptions{configAccess: configAccess} options := &createContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("set-context NAME [--%v=cluster_nickname] [--%v=user_nickname] [--%v=namespace]", clientcmd.FlagClusterName, clientcmd.FlagAuthInfoName, clientcmd.FlagNamespace), Use: fmt.Sprintf("set-context NAME [--%v=cluster_nickname] [--%v=user_nickname] [--%v=namespace]", clientcmd.FlagClusterName, clientcmd.FlagAuthInfoName, clientcmd.FlagNamespace),
DisableFlagsInUseLine: true,
Short: i18n.T("Sets a context entry in kubeconfig"), Short: i18n.T("Sets a context entry in kubeconfig"),
Long: create_context_long, Long: create_context_long,
Example: create_context_example, Example: create_context_example,
......
...@@ -35,7 +35,8 @@ var ( ...@@ -35,7 +35,8 @@ var (
func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete-cluster NAME", Use: "delete-cluster NAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Delete the specified cluster from the kubeconfig"), Short: i18n.T("Delete the specified cluster from the kubeconfig"),
Long: "Delete the specified cluster from the kubeconfig", Long: "Delete the specified cluster from the kubeconfig",
Example: delete_cluster_example, Example: delete_cluster_example,
......
...@@ -35,7 +35,8 @@ var ( ...@@ -35,7 +35,8 @@ var (
func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete-context NAME", Use: "delete-context NAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Delete the specified context from the kubeconfig"), Short: i18n.T("Delete the specified context from the kubeconfig"),
Long: "Delete the specified context from the kubeconfig", Long: "Delete the specified context from the kubeconfig",
Example: delete_context_example, Example: delete_context_example,
......
...@@ -61,7 +61,8 @@ func NewCmdConfigGetContexts(out io.Writer, configAccess clientcmd.ConfigAccess) ...@@ -61,7 +61,8 @@ func NewCmdConfigGetContexts(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &GetContextsOptions{configAccess: configAccess} options := &GetContextsOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "get-contexts [(-o|--output=)name)]", Use: "get-contexts [(-o|--output=)name)]",
DisableFlagsInUseLine: true,
Short: i18n.T("Describe one or many contexts"), Short: i18n.T("Describe one or many contexts"),
Long: getContextsLong, Long: getContextsLong,
Example: getContextsExample, Example: getContextsExample,
......
...@@ -61,7 +61,8 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces ...@@ -61,7 +61,8 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces
options := &RenameContextOptions{configAccess: configAccess} options := &RenameContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: renameContextUse, Use: renameContextUse,
DisableFlagsInUseLine: true,
Short: renameContextShort, Short: renameContextShort,
Long: renameContextLong, Long: renameContextLong,
Example: renameContextExample, Example: renameContextExample,
......
...@@ -56,7 +56,8 @@ func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra. ...@@ -56,7 +56,8 @@ func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.
options := &setOptions{configAccess: configAccess} options := &setOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set PROPERTY_NAME PROPERTY_VALUE", Use: "set PROPERTY_NAME PROPERTY_VALUE",
DisableFlagsInUseLine: true,
Short: i18n.T("Sets an individual value in a kubeconfig file"), Short: i18n.T("Sets an individual value in a kubeconfig file"),
Long: set_long, Long: set_long,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
......
...@@ -44,7 +44,8 @@ func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobr ...@@ -44,7 +44,8 @@ func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobr
options := &unsetOptions{configAccess: configAccess} options := &unsetOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "unset PROPERTY_NAME", Use: "unset PROPERTY_NAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Unsets an individual value in a kubeconfig file"), Short: i18n.T("Unsets an individual value in a kubeconfig file"),
Long: unset_long, Long: unset_long,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
......
...@@ -45,7 +45,8 @@ func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess) ...@@ -45,7 +45,8 @@ func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess)
options := &useContextOptions{configAccess: configAccess} options := &useContextOptions{configAccess: configAccess}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "use-context CONTEXT_NAME", Use: "use-context CONTEXT_NAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Sets the current-context in a kubeconfig file"), Short: i18n.T("Sets the current-context in a kubeconfig file"),
Aliases: []string{"use"}, Aliases: []string{"use"},
Long: `Sets the current-context in a kubeconfig file`, Long: `Sets the current-context in a kubeconfig file`,
......
...@@ -65,7 +65,8 @@ func NewCmdConvert(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -65,7 +65,8 @@ func NewCmdConvert(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &ConvertOptions{} options := &ConvertOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "convert -f FILENAME", Use: "convert -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Convert config files between different API versions"), Short: i18n.T("Convert config files between different API versions"),
Long: convert_long, Long: convert_long,
Example: convert_example, Example: convert_example,
......
...@@ -64,7 +64,8 @@ var ( ...@@ -64,7 +64,8 @@ var (
// NewCmdCp creates a new Copy command. // NewCmdCp creates a new Copy command.
func NewCmdCp(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command { func NewCmdCp(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "cp <file-spec-src> <file-spec-dest>", Use: "cp <file-spec-src> <file-spec-dest>",
DisableFlagsInUseLine: true,
Short: i18n.T("Copy files and directories to and from containers."), Short: i18n.T("Copy files and directories to and from containers."),
Long: "Copy files and directories to and from containers.", Long: "Copy files and directories to and from containers.",
Example: cpExample, Example: cpExample,
......
...@@ -65,7 +65,8 @@ func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { ...@@ -65,7 +65,8 @@ func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
var options CreateOptions var options CreateOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "create -f FILENAME", Use: "create -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a resource from a file or from stdin."), Short: i18n.T("Create a resource from a file or from stdin."),
Long: createLong, Long: createLong,
Example: createExample, Example: createExample,
......
...@@ -66,7 +66,8 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command ...@@ -66,7 +66,8 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command
}, },
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]", Use: "clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run]",
DisableFlagsInUseLine: true,
Short: clusterRoleLong, Short: clusterRoleLong,
Long: clusterRoleLong, Long: clusterRoleLong,
Example: clusterRoleExample, Example: clusterRoleExample,
......
...@@ -39,7 +39,8 @@ var ( ...@@ -39,7 +39,8 @@ var (
// ClusterRoleBinding is a command to ease creating ClusterRoleBindings. // ClusterRoleBinding is a command to ease creating ClusterRoleBindings.
func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", Use: "clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a ClusterRoleBinding for a particular ClusterRole"), Short: i18n.T("Create a ClusterRoleBinding for a particular ClusterRole"),
Long: clusterRoleBindingLong, Long: clusterRoleBindingLong,
Example: clusterRoleBindingExample, Example: clusterRoleBindingExample,
......
...@@ -60,11 +60,12 @@ var ( ...@@ -60,11 +60,12 @@ var (
// ConfigMap is a command to ease creating ConfigMaps. // ConfigMap is a command to ease creating ConfigMaps.
func NewCmdCreateConfigMap(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateConfigMap(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]",
Aliases: []string{"cm"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a configmap from a local file, directory or literal value"), Aliases: []string{"cm"},
Long: configMapLong, Short: i18n.T("Create a configmap from a local file, directory or literal value"),
Example: configMapExample, Long: configMapLong,
Example: configMapExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := CreateConfigMap(f, cmdOut, cmd, args) err := CreateConfigMap(f, cmdOut, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -41,11 +41,12 @@ var ( ...@@ -41,11 +41,12 @@ var (
// Note that this command overlaps significantly with the `kubectl run` command. // Note that this command overlaps significantly with the `kubectl run` command.
func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command { func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "deployment NAME --image=image [--dry-run]", Use: "deployment NAME --image=image [--dry-run]",
Aliases: []string{"deploy"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a deployment with the specified name."), Aliases: []string{"deploy"},
Long: deploymentLong, Short: i18n.T("Create a deployment with the specified name."),
Example: deploymentExample, Long: deploymentLong,
Example: deploymentExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := createDeployment(f, cmdOut, cmdErr, cmd, args) err := createDeployment(f, cmdOut, cmdErr, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -39,11 +39,12 @@ var ( ...@@ -39,11 +39,12 @@ var (
// NewCmdCreateNamespace is a macro command to create a new namespace // NewCmdCreateNamespace is a macro command to create a new namespace
func NewCmdCreateNamespace(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateNamespace(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "namespace NAME [--dry-run]", Use: "namespace NAME [--dry-run]",
Aliases: []string{"ns"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a namespace with the specified name"), Aliases: []string{"ns"},
Long: namespaceLong, Short: i18n.T("Create a namespace with the specified name"),
Example: namespaceExample, Long: namespaceLong,
Example: namespaceExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := CreateNamespace(f, cmdOut, cmd, args) err := CreateNamespace(f, cmdOut, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -44,11 +44,12 @@ var ( ...@@ -44,11 +44,12 @@ var (
// NewCmdCreatePodDisruptionBudget is a macro command to create a new pod disruption budget. // NewCmdCreatePodDisruptionBudget is a macro command to create a new pod disruption budget.
func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]", Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]",
Aliases: []string{"pdb"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a pod disruption budget with the specified name."), Aliases: []string{"pdb"},
Long: pdbLong, Short: i18n.T("Create a pod disruption budget with the specified name."),
Example: pdbExample, Long: pdbLong,
Example: pdbExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := CreatePodDisruptionBudget(f, cmdOut, cmd, args) err := CreatePodDisruptionBudget(f, cmdOut, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -42,11 +42,12 @@ var ( ...@@ -42,11 +42,12 @@ var (
// NewCmdCreatePriorityClass is a macro command to create a new priorityClass. // NewCmdCreatePriorityClass is a macro command to create a new priorityClass.
func NewCmdCreatePriorityClass(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreatePriorityClass(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]", Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]",
Aliases: []string{"pc"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a priorityclass with the specified name."), Aliases: []string{"pc"},
Long: pcLong, Short: i18n.T("Create a priorityclass with the specified name."),
Example: pcExample, Long: pcLong,
Example: pcExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(CreatePriorityClass(f, cmdOut, cmd, args)) cmdutil.CheckErr(CreatePriorityClass(f, cmdOut, cmd, args))
}, },
......
...@@ -42,11 +42,12 @@ var ( ...@@ -42,11 +42,12 @@ var (
// NewCmdCreateQuota is a macro command to create a new quota // NewCmdCreateQuota is a macro command to create a new quota
func NewCmdCreateQuota(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateQuota(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]", Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]",
Aliases: []string{"resourcequota"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a quota with the specified name."), Aliases: []string{"resourcequota"},
Long: quotaLong, Short: i18n.T("Create a quota with the specified name."),
Example: quotaExample, Long: quotaLong,
Example: quotaExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := CreateQuota(f, cmdOut, cmd, args) err := CreateQuota(f, cmdOut, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -121,7 +121,8 @@ func NewCmdCreateRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { ...@@ -121,7 +121,8 @@ func NewCmdCreateRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
Out: cmdOut, Out: cmdOut,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run]", Use: "role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run]",
DisableFlagsInUseLine: true,
Short: roleLong, Short: roleLong,
Long: roleLong, Long: roleLong,
Example: roleExample, Example: roleExample,
......
...@@ -39,7 +39,8 @@ var ( ...@@ -39,7 +39,8 @@ var (
// RoleBinding is a command to ease creating RoleBindings. // RoleBinding is a command to ease creating RoleBindings.
func NewCmdCreateRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", Use: "rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a RoleBinding for a particular Role or ClusterRole"), Short: i18n.T("Create a RoleBinding for a particular Role or ClusterRole"),
Long: roleBindingLong, Long: roleBindingLong,
Example: roleBindingExample, Example: roleBindingExample,
......
...@@ -76,7 +76,8 @@ var ( ...@@ -76,7 +76,8 @@ var (
// NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values // NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values
func NewCmdCreateSecretGeneric(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateSecretGeneric(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", Use: "generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a secret from a local file, directory or literal value"), Short: i18n.T("Create a secret from a local file, directory or literal value"),
Long: secretLong, Long: secretLong,
Example: secretExample, Example: secretExample,
...@@ -149,7 +150,8 @@ var ( ...@@ -149,7 +150,8 @@ var (
// NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries // NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries
func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]", Use: "docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a secret for use with a Docker registry"), Short: i18n.T("Create a secret for use with a Docker registry"),
Long: secretForDockerRegistryLong, Long: secretForDockerRegistryLong,
Example: secretForDockerRegistryExample, Example: secretForDockerRegistryExample,
...@@ -223,7 +225,8 @@ var ( ...@@ -223,7 +225,8 @@ var (
// NewCmdCreateSecretTLS is a macro command for creating secrets to work with Docker registries // NewCmdCreateSecretTLS is a macro command for creating secrets to work with Docker registries
func NewCmdCreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]", Use: "tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a TLS secret"), Short: i18n.T("Create a TLS secret"),
Long: secretForTLSLong, Long: secretForTLSLong,
Example: secretForTLSExample, Example: secretForTLSExample,
......
...@@ -64,7 +64,8 @@ func addPortFlags(cmd *cobra.Command) { ...@@ -64,7 +64,8 @@ func addPortFlags(cmd *cobra.Command) {
// NewCmdCreateServiceClusterIP is a command to create a ClusterIP service // NewCmdCreateServiceClusterIP is a command to create a ClusterIP service
func NewCmdCreateServiceClusterIP(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateServiceClusterIP(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run]", Use: "clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a ClusterIP service."), Short: i18n.T("Create a ClusterIP service."),
Long: serviceClusterIPLong, Long: serviceClusterIPLong,
Example: serviceClusterIPExample, Example: serviceClusterIPExample,
...@@ -124,7 +125,8 @@ var ( ...@@ -124,7 +125,8 @@ var (
// NewCmdCreateServiceNodePort is a macro command for creating a NodePort service // NewCmdCreateServiceNodePort is a macro command for creating a NodePort service
func NewCmdCreateServiceNodePort(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateServiceNodePort(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run]", Use: "nodeport NAME [--tcp=port:targetPort] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a NodePort service."), Short: i18n.T("Create a NodePort service."),
Long: serviceNodePortLong, Long: serviceNodePortLong,
Example: serviceNodePortExample, Example: serviceNodePortExample,
...@@ -181,7 +183,8 @@ var ( ...@@ -181,7 +183,8 @@ var (
// NewCmdCreateServiceLoadBalancer is a macro command for creating a LoadBalancer service // NewCmdCreateServiceLoadBalancer is a macro command for creating a LoadBalancer service
func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run]", Use: "loadbalancer NAME [--tcp=port:targetPort] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create a LoadBalancer service."), Short: i18n.T("Create a LoadBalancer service."),
Long: serviceLoadBalancerLong, Long: serviceLoadBalancerLong,
Example: serviceLoadBalancerExample, Example: serviceLoadBalancerExample,
...@@ -240,7 +243,8 @@ var ( ...@@ -240,7 +243,8 @@ var (
// NewCmdCreateServiceExternalName is a macro command for creating an ExternalName service // NewCmdCreateServiceExternalName is a macro command for creating an ExternalName service
func NewCmdCreateServiceExternalName(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateServiceExternalName(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "externalname NAME --external-name external.name [--dry-run]", Use: "externalname NAME --external-name external.name [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Create an ExternalName service."), Short: i18n.T("Create an ExternalName service."),
Long: serviceExternalNameLong, Long: serviceExternalNameLong,
Example: serviceExternalNameExample, Example: serviceExternalNameExample,
......
...@@ -39,11 +39,12 @@ var ( ...@@ -39,11 +39,12 @@ var (
// NewCmdCreateServiceAccount is a macro command to create a new service account // NewCmdCreateServiceAccount is a macro command to create a new service account
func NewCmdCreateServiceAccount(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { func NewCmdCreateServiceAccount(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "serviceaccount NAME [--dry-run]", Use: "serviceaccount NAME [--dry-run]",
Aliases: []string{"sa"}, DisableFlagsInUseLine: true,
Short: i18n.T("Create a service account with the specified name"), Aliases: []string{"sa"},
Long: serviceAccountLong, Short: i18n.T("Create a service account with the specified name"),
Example: serviceAccountExample, Long: serviceAccountLong,
Example: serviceAccountExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := CreateServiceAccount(f, cmdOut, cmd, args) err := CreateServiceAccount(f, cmdOut, cmd, args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
......
...@@ -127,7 +127,8 @@ func NewCmdDelete(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { ...@@ -127,7 +127,8 @@ func NewCmdDelete(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])", Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
DisableFlagsInUseLine: true,
Short: i18n.T("Delete resources by filenames, stdin, resources and names, or by resources and label selector"), Short: i18n.T("Delete resources by filenames, stdin, resources and names, or by resources and label selector"),
Long: delete_long, Long: delete_long,
Example: delete_example, Example: delete_example,
......
...@@ -44,6 +44,7 @@ var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer ...@@ -44,6 +44,7 @@ var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer
var fakecmd = &cobra.Command{ var fakecmd = &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])", Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd))
}, },
......
...@@ -79,7 +79,8 @@ func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command { ...@@ -79,7 +79,8 @@ func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)", Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("Show details of a specific resource or group of resources"), Short: i18n.T("Show details of a specific resource or group of resources"),
Long: describeLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Long: describeLong + "\n\n" + cmdutil.ValidResourceTypeList(f),
Example: describeExample, Example: describeExample,
......
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"net/http" "net/http"
"strings"
"testing" "testing"
"k8s.io/client-go/rest/fake" "k8s.io/client-go/rest/fake"
...@@ -168,3 +169,30 @@ func TestDescribeObjectSkipEvents(t *testing.T) { ...@@ -168,3 +169,30 @@ func TestDescribeObjectSkipEvents(t *testing.T) {
t.Errorf("ShowEvents = false expected, got ShowEvents = %v", d.Settings.ShowEvents) t.Errorf("ShowEvents = false expected, got ShowEvents = %v", d.Settings.ShowEvents)
} }
} }
func TestDescribeHelpMessage(t *testing.T) {
f, _, _, _ := cmdtesting.NewAPIFactory()
buf := bytes.NewBuffer([]byte{})
buferr := bytes.NewBuffer([]byte{})
cmd := NewCmdDescribe(f, buf, buferr)
cmd.SetArgs([]string{"-h"})
cmd.SetOutput(buf)
_, err := cmd.ExecuteC()
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
got := buf.String()
expected := `describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)`
if !strings.Contains(got, expected) {
t.Errorf("Expected to contain: \n %v\nGot:\n %v\n", expected, got)
}
unexpected := `describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME) [flags]`
if strings.Contains(got, unexpected) {
t.Errorf("Expected not to contain: \n %v\nGot:\n %v\n", unexpected, got)
}
}
...@@ -109,7 +109,8 @@ func NewCmdDiff(f cmdutil.Factory, stdout, stderr io.Writer) *cobra.Command { ...@@ -109,7 +109,8 @@ func NewCmdDiff(f cmdutil.Factory, stdout, stderr io.Writer) *cobra.Command {
Stderr: stderr, Stderr: stderr,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "diff -f FILENAME", Use: "diff -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Diff different versions of configurations"), Short: i18n.T("Diff different versions of configurations"),
Long: diffLong, Long: diffLong,
Example: diffExample, Example: diffExample,
......
...@@ -105,7 +105,8 @@ func NewCmdCordon(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -105,7 +105,8 @@ func NewCmdCordon(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &DrainOptions{Factory: f, Out: out} options := &DrainOptions{Factory: f, Out: out}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "cordon NODE", Use: "cordon NODE",
DisableFlagsInUseLine: true,
Short: i18n.T("Mark node as unschedulable"), Short: i18n.T("Mark node as unschedulable"),
Long: cordon_long, Long: cordon_long,
Example: cordon_example, Example: cordon_example,
...@@ -132,7 +133,8 @@ func NewCmdUncordon(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -132,7 +133,8 @@ func NewCmdUncordon(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &DrainOptions{Factory: f, Out: out} options := &DrainOptions{Factory: f, Out: out}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "uncordon NODE", Use: "uncordon NODE",
DisableFlagsInUseLine: true,
Short: i18n.T("Mark node as schedulable"), Short: i18n.T("Mark node as schedulable"),
Long: uncordon_long, Long: uncordon_long,
Example: uncordon_example, Example: uncordon_example,
...@@ -184,7 +186,8 @@ func NewCmdDrain(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { ...@@ -184,7 +186,8 @@ func NewCmdDrain(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
options := &DrainOptions{Factory: f, Out: out, ErrOut: errOut, backOff: clockwork.NewRealClock()} options := &DrainOptions{Factory: f, Out: out, ErrOut: errOut, backOff: clockwork.NewRealClock()}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "drain NODE", Use: "drain NODE",
DisableFlagsInUseLine: true,
Short: i18n.T("Drain node in preparation for maintenance"), Short: i18n.T("Drain node in preparation for maintenance"),
Long: drain_long, Long: drain_long,
Example: drain_example, Example: drain_example,
......
...@@ -87,7 +87,8 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { ...@@ -87,7 +87,8 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "edit (RESOURCE/NAME | -f FILENAME)", Use: "edit (RESOURCE/NAME | -f FILENAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("Edit a resource on the server"), Short: i18n.T("Edit a resource on the server"),
Long: editLong, Long: editLong,
Example: fmt.Sprintf(editExample), Example: fmt.Sprintf(editExample),
......
...@@ -73,7 +73,8 @@ func NewCmdExec(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *c ...@@ -73,7 +73,8 @@ func NewCmdExec(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *c
Executor: &DefaultRemoteExecutor{}, Executor: &DefaultRemoteExecutor{},
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "exec POD [-c CONTAINER] -- COMMAND [args...]", Use: "exec POD [-c CONTAINER] -- COMMAND [args...]",
DisableFlagsInUseLine: true,
Short: i18n.T("Execute a command in a container"), Short: i18n.T("Execute a command in a container"),
Long: "Execute a command in a container.", Long: "Execute a command in a container.",
Example: exec_example, Example: exec_example,
......
...@@ -53,7 +53,8 @@ var ( ...@@ -53,7 +53,8 @@ var (
// NewCmdExplain returns a cobra command for swagger docs // NewCmdExplain returns a cobra command for swagger docs
func NewCmdExplain(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command { func NewCmdExplain(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "explain RESOURCE", Use: "explain RESOURCE",
DisableFlagsInUseLine: true,
Short: i18n.T("Documentation of resources"), Short: i18n.T("Documentation of resources"),
Long: explainLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Long: explainLong + "\n\n" + cmdutil.ValidResourceTypeList(f),
Example: explainExamples, Example: explainExamples,
......
...@@ -83,7 +83,8 @@ func NewCmdExposeService(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -83,7 +83,8 @@ func NewCmdExposeService(f cmdutil.Factory, out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]", Use: "expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]",
DisableFlagsInUseLine: true,
Short: i18n.T("Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service"), Short: i18n.T("Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service"),
Long: exposeLong, Long: exposeLong,
Example: exposeExample, Example: exposeExample,
......
...@@ -31,7 +31,8 @@ var helpLong = templates.LongDesc(i18n.T(` ...@@ -31,7 +31,8 @@ var helpLong = templates.LongDesc(i18n.T(`
func NewCmdHelp() *cobra.Command { func NewCmdHelp() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "help [command] | STRING_TO_SEARCH", Use: "help [command] | STRING_TO_SEARCH",
DisableFlagsInUseLine: true,
Short: i18n.T("Help about any command"), Short: i18n.T("Help about any command"),
Long: helpLong, Long: helpLong,
......
...@@ -111,7 +111,8 @@ func NewCmdLabel(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -111,7 +111,8 @@ func NewCmdLabel(f cmdutil.Factory, out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]", Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
DisableFlagsInUseLine: true,
Short: i18n.T("Update the labels on a resource"), Short: i18n.T("Update the labels on a resource"),
Long: fmt.Sprintf(labelLong, validation.LabelValueMaxLength), Long: fmt.Sprintf(labelLong, validation.LabelValueMaxLength),
Example: labelExample, Example: labelExample,
......
...@@ -89,7 +89,8 @@ type LogsOptions struct { ...@@ -89,7 +89,8 @@ type LogsOptions struct {
func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command {
o := &LogsOptions{} o := &LogsOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]", Use: "logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]",
DisableFlagsInUseLine: true,
Short: i18n.T("Print the logs for a container in a pod"), Short: i18n.T("Print the logs for a container in a pod"),
Long: "Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.", Long: "Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.",
Example: logsExample, Example: logsExample,
......
...@@ -95,7 +95,8 @@ func NewCmdPatch(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -95,7 +95,8 @@ func NewCmdPatch(f cmdutil.Factory, out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "patch (-f FILENAME | TYPE NAME) -p PATCH", Use: "patch (-f FILENAME | TYPE NAME) -p PATCH",
DisableFlagsInUseLine: true,
Short: i18n.T("Update field(s) of a resource using strategic merge patch"), Short: i18n.T("Update field(s) of a resource using strategic merge patch"),
Long: patchLong, Long: patchLong,
Example: patchExample, Example: patchExample,
......
...@@ -50,7 +50,8 @@ func NewCmdPlugin(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Co ...@@ -50,7 +50,8 @@ func NewCmdPlugin(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Co
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "plugin NAME", Use: "plugin NAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Runs a command-line plugin"), Short: i18n.T("Runs a command-line plugin"),
Long: plugin_long, Long: plugin_long,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
......
...@@ -70,7 +70,8 @@ func NewCmdPortForward(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Comma ...@@ -70,7 +70,8 @@ func NewCmdPortForward(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Comma
}, },
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]", Use: "port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]",
DisableFlagsInUseLine: true,
Short: i18n.T("Forward one or more local ports to a pod"), Short: i18n.T("Forward one or more local ports to a pod"),
Long: "Forward one or more local ports to a pod.", Long: "Forward one or more local ports to a pod.",
Example: portforwardExample, Example: portforwardExample,
......
...@@ -71,7 +71,8 @@ var ( ...@@ -71,7 +71,8 @@ var (
func NewCmdProxy(f cmdutil.Factory, out io.Writer) *cobra.Command { func NewCmdProxy(f cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]", Use: "proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]",
DisableFlagsInUseLine: true,
Short: i18n.T("Run a proxy to the Kubernetes API server"), Short: i18n.T("Run a proxy to the Kubernetes API server"),
Long: proxyLong, Long: proxyLong,
Example: proxyExample, Example: proxyExample,
......
...@@ -64,7 +64,8 @@ func NewCmdReplace(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -64,7 +64,8 @@ func NewCmdReplace(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &resource.FilenameOptions{} options := &resource.FilenameOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "replace -f FILENAME", Use: "replace -f FILENAME",
DisableFlagsInUseLine: true,
Short: i18n.T("Replace a resource by filename or stdin"), Short: i18n.T("Replace a resource by filename or stdin"),
Long: replaceLong, Long: replaceLong,
Example: replaceExample, Example: replaceExample,
......
...@@ -139,7 +139,8 @@ func NewCmdGet(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comman ...@@ -139,7 +139,8 @@ func NewCmdGet(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comman
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]", Use: "get [(-o|--output=)json|yaml|wide|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]",
DisableFlagsInUseLine: true,
Short: i18n.T("Display one or many resources"), Short: i18n.T("Display one or many resources"),
Long: getLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Long: getLong + "\n\n" + cmdutil.ValidResourceTypeList(f),
Example: getExample, Example: getExample,
......
...@@ -79,7 +79,8 @@ func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -79,7 +79,8 @@ func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &resource.FilenameOptions{} options := &resource.FilenameOptions{}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)", Use: "rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)",
DisableFlagsInUseLine: true,
Short: i18n.T("Perform a rolling update of the given ReplicationController"), Short: i18n.T("Perform a rolling update of the given ReplicationController"),
Long: rollingUpdateLong, Long: rollingUpdateLong,
Example: rollingUpdateExample, Example: rollingUpdateExample,
...@@ -93,9 +94,7 @@ func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -93,9 +94,7 @@ func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command {
cmd.Flags().Duration("timeout", timeout, `Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) cmd.Flags().Duration("timeout", timeout, `Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`)
usage := "Filename or URL to file to use to create the new replication controller." usage := "Filename or URL to file to use to create the new replication controller."
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
cmd.MarkFlagRequired("filename")
cmd.Flags().String("image", "", i18n.T("Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f")) cmd.Flags().String("image", "", i18n.T("Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f"))
cmd.MarkFlagRequired("image")
cmd.Flags().String("deployment-label-key", "deployment", i18n.T("The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise")) cmd.Flags().String("deployment-label-key", "deployment", i18n.T("The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise"))
cmd.Flags().String("container", "", i18n.T("Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod")) cmd.Flags().String("container", "", i18n.T("Container name which will have its image upgraded. Only relevant when --image is specified, ignored otherwise. Required when using --image on a multi-container pod"))
cmd.Flags().String("image-pull-policy", "", i18n.T("Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise.")) cmd.Flags().String("image-pull-policy", "", i18n.T("Explicit policy for when to pull container images. Required when --image is same as existing image, ignored otherwise."))
......
...@@ -49,7 +49,8 @@ var ( ...@@ -49,7 +49,8 @@ var (
func NewCmdRollout(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { func NewCmdRollout(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "rollout SUBCOMMAND", Use: "rollout SUBCOMMAND",
DisableFlagsInUseLine: true,
Short: i18n.T("Manage the rollout of a resource"), Short: i18n.T("Manage the rollout of a resource"),
Long: rollout_long, Long: rollout_long,
Example: rollout_example, Example: rollout_example,
......
...@@ -48,7 +48,8 @@ func NewCmdRolloutHistory(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -48,7 +48,8 @@ func NewCmdRolloutHistory(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "history (TYPE NAME | TYPE/NAME) [flags]", Use: "history (TYPE NAME | TYPE/NAME) [flags]",
DisableFlagsInUseLine: true,
Short: i18n.T("View rollout history"), Short: i18n.T("View rollout history"),
Long: history_long, Long: history_long,
Example: history_example, Example: history_example,
......
...@@ -71,7 +71,8 @@ func NewCmdRolloutPause(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -71,7 +71,8 @@ func NewCmdRolloutPause(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "pause RESOURCE", Use: "pause RESOURCE",
DisableFlagsInUseLine: true,
Short: i18n.T("Mark the provided resource as paused"), Short: i18n.T("Mark the provided resource as paused"),
Long: pause_long, Long: pause_long,
Example: pause_example, Example: pause_example,
......
...@@ -69,7 +69,8 @@ func NewCmdRolloutResume(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -69,7 +69,8 @@ func NewCmdRolloutResume(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "resume RESOURCE", Use: "resume RESOURCE",
DisableFlagsInUseLine: true,
Short: i18n.T("Resume a paused resource"), Short: i18n.T("Resume a paused resource"),
Long: resume_long, Long: resume_long,
Example: resume_example, Example: resume_example,
......
...@@ -54,7 +54,8 @@ func NewCmdRolloutStatus(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -54,7 +54,8 @@ func NewCmdRolloutStatus(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "status (TYPE NAME | TYPE/NAME) [flags]", Use: "status (TYPE NAME | TYPE/NAME) [flags]",
DisableFlagsInUseLine: true,
Short: i18n.T("Show the status of the rollout"), Short: i18n.T("Show the status of the rollout"),
Long: status_long, Long: status_long,
Example: status_example, Example: status_example,
......
...@@ -69,7 +69,8 @@ func NewCmdRolloutUndo(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -69,7 +69,8 @@ func NewCmdRolloutUndo(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "undo (TYPE NAME | TYPE/NAME) [flags]", Use: "undo (TYPE NAME | TYPE/NAME) [flags]",
DisableFlagsInUseLine: true,
Short: i18n.T("Undo a previous rollout"), Short: i18n.T("Undo a previous rollout"),
Long: undo_long, Long: undo_long,
Example: undo_example, Example: undo_example,
......
...@@ -96,7 +96,8 @@ type RunObject struct { ...@@ -96,7 +96,8 @@ type RunObject struct {
func NewCmdRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command { func NewCmdRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "run NAME --image=image [--env=\"key=value\"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]", Use: "run NAME --image=image [--env=\"key=value\"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...]",
DisableFlagsInUseLine: true,
Short: i18n.T("Run a particular image on the cluster"), Short: i18n.T("Run a particular image on the cluster"),
Long: runLong, Long: runLong,
Example: runExample, Example: runExample,
......
...@@ -64,7 +64,8 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -64,7 +64,8 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)", Use: "scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)",
DisableFlagsInUseLine: true,
Short: i18n.T("Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job"), Short: i18n.T("Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job"),
Long: scaleLong, Long: scaleLong,
Example: scaleExample, Example: scaleExample,
......
...@@ -34,7 +34,8 @@ var ( ...@@ -34,7 +34,8 @@ var (
func NewCmdSet(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command { func NewCmdSet(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set SUBCOMMAND", Use: "set SUBCOMMAND",
DisableFlagsInUseLine: true,
Short: i18n.T("Set specific features on objects"), Short: i18n.T("Set specific features on objects"),
Long: set_long, Long: set_long,
Run: cmdutil.DefaultSubCommandRun(err), Run: cmdutil.DefaultSubCommandRun(err),
......
...@@ -135,7 +135,8 @@ func NewCmdEnv(f cmdutil.Factory, in io.Reader, out, errout io.Writer) *cobra.Co ...@@ -135,7 +135,8 @@ func NewCmdEnv(f cmdutil.Factory, in io.Reader, out, errout io.Writer) *cobra.Co
In: in, In: in,
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N", Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N",
DisableFlagsInUseLine: true,
Short: "Update environment variables on a pod template", Short: "Update environment variables on a pod template",
Long: envLong, Long: envLong,
Example: fmt.Sprintf(envExample), Example: fmt.Sprintf(envExample),
......
...@@ -92,7 +92,8 @@ func NewCmdImage(f cmdutil.Factory, out, err io.Writer) *cobra.Command { ...@@ -92,7 +92,8 @@ func NewCmdImage(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N", Use: "image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N",
DisableFlagsInUseLine: true,
Short: i18n.T("Update image of a pod template"), Short: i18n.T("Update image of a pod template"),
Long: image_long, Long: image_long,
Example: image_example, Example: image_example,
......
...@@ -98,7 +98,8 @@ func NewCmdResources(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra. ...@@ -98,7 +98,8 @@ func NewCmdResources(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]", Use: "resources (-f FILENAME | TYPE NAME) ([--limits=LIMITS & --requests=REQUESTS]",
DisableFlagsInUseLine: true,
Short: i18n.T("Update resource requests/limits on objects with pod templates"), Short: i18n.T("Update resource requests/limits on objects with pod templates"),
Long: fmt.Sprintf(resources_long, strings.Join(resourceTypesWithPodTemplate, ", ")), Long: fmt.Sprintf(resources_long, strings.Join(resourceTypesWithPodTemplate, ", ")),
Example: resources_example, Example: resources_example,
......
...@@ -79,7 +79,8 @@ func NewCmdSelector(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -79,7 +79,8 @@ func NewCmdSelector(f cmdutil.Factory, out io.Writer) *cobra.Command {
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]", Use: "selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]",
DisableFlagsInUseLine: true,
Short: i18n.T("Set the selector on a resource"), Short: i18n.T("Set the selector on a resource"),
Long: fmt.Sprintf(selectorLong, validation.LabelValueMaxLength), Long: fmt.Sprintf(selectorLong, validation.LabelValueMaxLength),
Example: selectorExample, Example: selectorExample,
......
...@@ -83,11 +83,12 @@ func NewCmdServiceAccount(f cmdutil.Factory, out, err io.Writer) *cobra.Command ...@@ -83,11 +83,12 @@ func NewCmdServiceAccount(f cmdutil.Factory, out, err io.Writer) *cobra.Command
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT", Use: "serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT",
Aliases: []string{"sa"}, DisableFlagsInUseLine: true,
Short: i18n.T("Update ServiceAccount of a resource"), Aliases: []string{"sa"},
Long: serviceaccountLong, Short: i18n.T("Update ServiceAccount of a resource"),
Example: serviceaccountExample, Long: serviceaccountLong,
Example: serviceaccountExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(saConfig.Complete(f, cmd, args)) cmdutil.CheckErr(saConfig.Complete(f, cmd, args))
cmdutil.CheckErr(saConfig.Run()) cmdutil.CheckErr(saConfig.Run())
......
...@@ -84,7 +84,8 @@ func NewCmdSubject(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Co ...@@ -84,7 +84,8 @@ func NewCmdSubject(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Co
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]", Use: "subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run]",
DisableFlagsInUseLine: true,
Short: i18n.T("Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding"), Short: i18n.T("Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding"),
Long: subject_long, Long: subject_long,
Example: subject_example, Example: subject_example,
......
...@@ -85,7 +85,8 @@ func NewCmdTaint(f cmdutil.Factory, out io.Writer) *cobra.Command { ...@@ -85,7 +85,8 @@ func NewCmdTaint(f cmdutil.Factory, out io.Writer) *cobra.Command {
argAliases := kubectl.ResourceAliases(validArgs) argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N", Use: "taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N",
DisableFlagsInUseLine: true,
Short: i18n.T("Update the taints on one or more nodes"), Short: i18n.T("Update the taints on one or more nodes"),
Long: fmt.Sprintf(taintLong, validation.DNS1123SubdomainMaxLength, validation.LabelValueMaxLength), Long: fmt.Sprintf(taintLong, validation.DNS1123SubdomainMaxLength, validation.LabelValueMaxLength),
Example: taintExample, Example: taintExample,
......
...@@ -89,7 +89,8 @@ func NewCmdTopNode(f cmdutil.Factory, options *TopNodeOptions, out io.Writer) *c ...@@ -89,7 +89,8 @@ func NewCmdTopNode(f cmdutil.Factory, options *TopNodeOptions, out io.Writer) *c
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "node [NAME | -l label]", Use: "node [NAME | -l label]",
DisableFlagsInUseLine: true,
Short: i18n.T("Display Resource (CPU/Memory/Storage) usage of nodes"), Short: i18n.T("Display Resource (CPU/Memory/Storage) usage of nodes"),
Long: topNodeLong, Long: topNodeLong,
Example: topNodeExample, Example: topNodeExample,
......
...@@ -78,7 +78,8 @@ func NewCmdTopPod(f cmdutil.Factory, options *TopPodOptions, out io.Writer) *cob ...@@ -78,7 +78,8 @@ func NewCmdTopPod(f cmdutil.Factory, options *TopPodOptions, out io.Writer) *cob
} }
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "pod [NAME | -l label]", Use: "pod [NAME | -l label]",
DisableFlagsInUseLine: true,
Short: i18n.T("Display Resource (CPU/Memory/Storage) usage of pods"), Short: i18n.T("Display Resource (CPU/Memory/Storage) usage of pods"),
Long: topPodLong, Long: topPodLong,
Example: topPodExample, Example: topPodExample,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment