From 1c715d51c42cafb042b4bb8b03e82a52c5070409 Mon Sep 17 00:00:00 2001 From: Di Xu Date: Wed, 11 Oct 2017 14:26:02 +0800 Subject: [PATCH] some code change fix wrong required flags disable the addition of [flags] to the usage, use customized useline fix function rename --- cmd/genkubedocs/postprocessing.go | 2 +- cmd/kubeadm/app/cmd/join.go | 2 +- cmd/kubeadm/app/cmd/token.go | 6 +++-- cmd/kubeadm/app/cmd/upgrade/apply.go | 3 ++- pkg/kubectl/cmd/annotate.go | 3 ++- pkg/kubectl/cmd/apply.go | 3 ++- pkg/kubectl/cmd/apply_edit_last_applied.go | 3 ++- pkg/kubectl/cmd/apply_set_last_applied.go | 3 ++- pkg/kubectl/cmd/apply_view_last_applied.go | 3 ++- pkg/kubectl/cmd/attach.go | 3 ++- pkg/kubectl/cmd/auth/cani.go | 3 ++- pkg/kubectl/cmd/auth/reconcile.go | 3 ++- pkg/kubectl/cmd/autoscale.go | 3 ++- pkg/kubectl/cmd/certificates.go | 9 ++++--- pkg/kubectl/cmd/completion.go | 3 ++- pkg/kubectl/cmd/config/config.go | 3 ++- pkg/kubectl/cmd/config/create_authinfo.go | 3 ++- pkg/kubectl/cmd/config/create_cluster.go | 3 ++- pkg/kubectl/cmd/config/create_context.go | 3 ++- pkg/kubectl/cmd/config/delete_cluster.go | 3 ++- pkg/kubectl/cmd/config/delete_context.go | 3 ++- pkg/kubectl/cmd/config/get_contexts.go | 3 ++- pkg/kubectl/cmd/config/rename_context.go | 3 ++- pkg/kubectl/cmd/config/set.go | 3 ++- pkg/kubectl/cmd/config/unset.go | 3 ++- pkg/kubectl/cmd/config/use_context.go | 3 ++- pkg/kubectl/cmd/convert.go | 3 ++- pkg/kubectl/cmd/cp.go | 3 ++- pkg/kubectl/cmd/create.go | 3 ++- pkg/kubectl/cmd/create_clusterrole.go | 3 ++- pkg/kubectl/cmd/create_clusterrolebinding.go | 3 ++- pkg/kubectl/cmd/create_configmap.go | 11 ++++---- pkg/kubectl/cmd/create_deployment.go | 11 ++++---- pkg/kubectl/cmd/create_namespace.go | 11 ++++---- pkg/kubectl/cmd/create_pdb.go | 11 ++++---- pkg/kubectl/cmd/create_priorityclass.go | 11 ++++---- pkg/kubectl/cmd/create_quota.go | 11 ++++---- pkg/kubectl/cmd/create_role.go | 3 ++- pkg/kubectl/cmd/create_rolebinding.go | 3 ++- pkg/kubectl/cmd/create_secret.go | 9 ++++--- pkg/kubectl/cmd/create_service.go | 12 ++++++--- pkg/kubectl/cmd/create_serviceaccount.go | 11 ++++---- pkg/kubectl/cmd/delete.go | 3 ++- pkg/kubectl/cmd/delete_test.go | 1 + pkg/kubectl/cmd/describe.go | 3 ++- pkg/kubectl/cmd/describe_test.go | 28 ++++++++++++++++++++ pkg/kubectl/cmd/diff.go | 3 ++- pkg/kubectl/cmd/drain.go | 9 ++++--- pkg/kubectl/cmd/edit.go | 3 ++- pkg/kubectl/cmd/exec.go | 3 ++- pkg/kubectl/cmd/explain.go | 3 ++- pkg/kubectl/cmd/expose.go | 3 ++- pkg/kubectl/cmd/help.go | 3 ++- pkg/kubectl/cmd/label.go | 3 ++- pkg/kubectl/cmd/logs.go | 3 ++- pkg/kubectl/cmd/patch.go | 3 ++- pkg/kubectl/cmd/plugin.go | 3 ++- pkg/kubectl/cmd/portforward.go | 3 ++- pkg/kubectl/cmd/proxy.go | 3 ++- pkg/kubectl/cmd/replace.go | 3 ++- pkg/kubectl/cmd/resource/get.go | 3 ++- pkg/kubectl/cmd/rollingupdate.go | 5 ++-- pkg/kubectl/cmd/rollout/rollout.go | 3 ++- pkg/kubectl/cmd/rollout/rollout_history.go | 3 ++- pkg/kubectl/cmd/rollout/rollout_pause.go | 3 ++- pkg/kubectl/cmd/rollout/rollout_resume.go | 3 ++- pkg/kubectl/cmd/rollout/rollout_status.go | 3 ++- pkg/kubectl/cmd/rollout/rollout_undo.go | 3 ++- pkg/kubectl/cmd/run.go | 3 ++- pkg/kubectl/cmd/scale.go | 3 ++- pkg/kubectl/cmd/set/set.go | 3 ++- pkg/kubectl/cmd/set/set_env.go | 3 ++- pkg/kubectl/cmd/set/set_image.go | 3 ++- pkg/kubectl/cmd/set/set_resources.go | 3 ++- pkg/kubectl/cmd/set/set_selector.go | 3 ++- pkg/kubectl/cmd/set/set_serviceaccount.go | 11 ++++---- pkg/kubectl/cmd/set/set_subject.go | 3 ++- pkg/kubectl/cmd/taint.go | 3 ++- pkg/kubectl/cmd/top_node.go | 3 ++- pkg/kubectl/cmd/top_pod.go | 3 ++- 80 files changed, 235 insertions(+), 122 deletions(-) diff --git a/cmd/genkubedocs/postprocessing.go b/cmd/genkubedocs/postprocessing.go index 57b6d95e058..c51e1443bc3 100644 --- a/cmd/genkubedocs/postprocessing.go +++ b/cmd/genkubedocs/postprocessing.go @@ -27,7 +27,7 @@ import ( // MarkdownPostProcessing goes though the generated files func MarkdownPostProcessing(cmd *cobra.Command, dir string, processor func(string) string) error { for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsHelpCommand() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { continue } if err := MarkdownPostProcessing(c, dir, processor); err != nil { diff --git a/cmd/kubeadm/app/cmd/join.go b/cmd/kubeadm/app/cmd/join.go index 2bc32fe4d72..14d7acce072 100644 --- a/cmd/kubeadm/app/cmd/join.go +++ b/cmd/kubeadm/app/cmd/join.go @@ -111,7 +111,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command { var ignorePreflightErrors []string cmd := &cobra.Command{ - Use: "join [flags]", + Use: "join", Short: "Run this on any machine you wish to join an existing cluster", Long: joinLongDescription, Run: func(cmd *cobra.Command, args []string) { diff --git a/cmd/kubeadm/app/cmd/token.go b/cmd/kubeadm/app/cmd/token.go index 87b8d077750..3c3799857a7 100644 --- a/cmd/kubeadm/app/cmd/token.go +++ b/cmd/kubeadm/app/cmd/token.go @@ -101,7 +101,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command { var description string var printJoinCommand bool createCmd := &cobra.Command{ - Use: "create [token]", + Use: "create [token]", + DisableFlagsInUseLine: true, Short: "Create bootstrap tokens on the server.", Long: dedent.Dedent(` This command will create a bootstrap token for you. @@ -155,7 +156,8 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command { tokenCmd.AddCommand(listCmd) deleteCmd := &cobra.Command{ - Use: "delete [token-value]", + Use: "delete [token-value]", + DisableFlagsInUseLine: true, Short: "Delete bootstrap tokens on the server.", Long: dedent.Dedent(` This command will delete a given bootstrap token for you. diff --git a/cmd/kubeadm/app/cmd/upgrade/apply.go b/cmd/kubeadm/app/cmd/upgrade/apply.go index 08629ef2b78..12101083c1b 100644 --- a/cmd/kubeadm/app/cmd/upgrade/apply.go +++ b/cmd/kubeadm/app/cmd/upgrade/apply.go @@ -69,7 +69,8 @@ func NewCmdApply(parentFlags *cmdUpgradeFlags) *cobra.Command { } cmd := &cobra.Command{ - Use: "apply [version]", + Use: "apply [version]", + DisableFlagsInUseLine: true, Short: "Upgrade your Kubernetes cluster to the specified version.", Run: func(cmd *cobra.Command, args []string) { var err error diff --git a/pkg/kubectl/cmd/annotate.go b/pkg/kubectl/cmd/annotate.go index 09541ea0e24..0637528d7e7 100644 --- a/pkg/kubectl/cmd/annotate.go +++ b/pkg/kubectl/cmd/annotate.go @@ -113,7 +113,8 @@ func NewCmdAnnotate(f cmdutil.Factory, out io.Writer) *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"), Long: annotateLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Example: annotateExample, diff --git a/pkg/kubectl/cmd/apply.go b/pkg/kubectl/cmd/apply.go index e132743231c..9bb6d194f81 100644 --- a/pkg/kubectl/cmd/apply.go +++ b/pkg/kubectl/cmd/apply.go @@ -105,7 +105,8 @@ func NewCmdApply(baseName string, f cmdutil.Factory, out, errOut io.Writer) *cob options.cmdBaseName = baseName 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"), Long: applyLong, Example: applyExample, diff --git a/pkg/kubectl/cmd/apply_edit_last_applied.go b/pkg/kubectl/cmd/apply_edit_last_applied.go index ca4868fa5b8..f12bb981e87 100644 --- a/pkg/kubectl/cmd/apply_edit_last_applied.go +++ b/pkg/kubectl/cmd/apply_edit_last_applied.go @@ -76,7 +76,8 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, out, errOut io.Writer) *cobra } 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", Long: applyEditLastAppliedLong, Example: applyEditLastAppliedExample, diff --git a/pkg/kubectl/cmd/apply_set_last_applied.go b/pkg/kubectl/cmd/apply_set_last_applied.go index 640009b2788..cc455f6a4c3 100644 --- a/pkg/kubectl/cmd/apply_set_last_applied.go +++ b/pkg/kubectl/cmd/apply_set_last_applied.go @@ -84,7 +84,8 @@ var ( func NewCmdApplySetLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command { options := &SetLastAppliedOptions{Out: out, ErrOut: err} 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."), Long: applySetLastAppliedLong, Example: applySetLastAppliedExample, diff --git a/pkg/kubectl/cmd/apply_view_last_applied.go b/pkg/kubectl/cmd/apply_view_last_applied.go index 7282ae6265f..b0ebb1af820 100644 --- a/pkg/kubectl/cmd/apply_view_last_applied.go +++ b/pkg/kubectl/cmd/apply_view_last_applied.go @@ -60,7 +60,8 @@ var ( func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command { options := &ViewLastAppliedOptions{Out: out, ErrOut: err} 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"), Long: applyViewLastAppliedLong, Example: applyViewLastAppliedExample, diff --git a/pkg/kubectl/cmd/attach.go b/pkg/kubectl/cmd/attach.go index 7bc49ca06da..1b188d10853 100644 --- a/pkg/kubectl/cmd/attach.go +++ b/pkg/kubectl/cmd/attach.go @@ -71,7 +71,8 @@ func NewCmdAttach(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) Attach: &DefaultRemoteAttach{}, } 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"), Long: "Attach to a process that is already running inside an existing container.", Example: attachExample, diff --git a/pkg/kubectl/cmd/auth/cani.go b/pkg/kubectl/cmd/auth/cani.go index 97e461a46fc..7484cab1895 100644 --- a/pkg/kubectl/cmd/auth/cani.go +++ b/pkg/kubectl/cmd/auth/cani.go @@ -88,7 +88,8 @@ func NewCmdCanI(f cmdutil.Factory, out, err io.Writer) *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", Long: canILong, Example: canIExample, diff --git a/pkg/kubectl/cmd/auth/reconcile.go b/pkg/kubectl/cmd/auth/reconcile.go index 0c65c954c38..377d241a00b 100644 --- a/pkg/kubectl/cmd/auth/reconcile.go +++ b/pkg/kubectl/cmd/auth/reconcile.go @@ -64,7 +64,8 @@ func NewCmdReconcile(f cmdutil.Factory, out, err io.Writer) *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", Long: reconcileLong, Example: reconcileExample, diff --git a/pkg/kubectl/cmd/autoscale.go b/pkg/kubectl/cmd/autoscale.go index 30406934fce..d87146cd073 100644 --- a/pkg/kubectl/cmd/autoscale.go +++ b/pkg/kubectl/cmd/autoscale.go @@ -52,7 +52,8 @@ func NewCmdAutoscale(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: autoscaleLong, Example: autoscaleExample, diff --git a/pkg/kubectl/cmd/certificates.go b/pkg/kubectl/cmd/certificates.go index bc2974322c2..ee51e4b266c 100644 --- a/pkg/kubectl/cmd/certificates.go +++ b/pkg/kubectl/cmd/certificates.go @@ -32,7 +32,8 @@ import ( func NewCmdCertificate(f cmdutil.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "certificate SUBCOMMAND", + Use: "certificate SUBCOMMAND", + DisableFlagsInUseLine: true, Short: i18n.T("Modify certificate resources."), Long: "Modify certificate resources.", Run: func(cmd *cobra.Command, args []string) { @@ -68,7 +69,8 @@ func (options *CertificateOptions) Validate() error { func NewCmdCertificateApprove(f cmdutil.Factory, out io.Writer) *cobra.Command { options := CertificateOptions{} cmd := &cobra.Command{ - Use: "approve (-f FILENAME | NAME)", + Use: "approve (-f FILENAME | NAME)", + DisableFlagsInUseLine: true, Short: i18n.T("Approve a certificate signing request"), Long: templates.LongDesc(` Approve a certificate signing request. @@ -118,7 +120,8 @@ func (options *CertificateOptions) RunCertificateApprove(f cmdutil.Factory, out func NewCmdCertificateDeny(f cmdutil.Factory, out io.Writer) *cobra.Command { options := CertificateOptions{} cmd := &cobra.Command{ - Use: "deny (-f FILENAME | NAME)", + Use: "deny (-f FILENAME | NAME)", + DisableFlagsInUseLine: true, Short: i18n.T("Deny a certificate signing request"), Long: templates.LongDesc(` Deny a certificate signing request. diff --git a/pkg/kubectl/cmd/completion.go b/pkg/kubectl/cmd/completion.go index d14ca66329b..d6d9a3506ca 100644 --- a/pkg/kubectl/cmd/completion.go +++ b/pkg/kubectl/cmd/completion.go @@ -97,7 +97,8 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *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)"), Long: completion_long, Example: completion_example, diff --git a/pkg/kubectl/cmd/config/config.go b/pkg/kubectl/cmd/config/config.go index b63d1cf15f3..7984eb5e15f 100644 --- a/pkg/kubectl/cmd/config/config.go +++ b/pkg/kubectl/cmd/config/config.go @@ -37,7 +37,8 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, out, er } cmd := &cobra.Command{ - Use: "config SUBCOMMAND", + Use: "config SUBCOMMAND", + DisableFlagsInUseLine: true, Short: i18n.T("Modify kubeconfig files"), Long: templates.LongDesc(` Modify kubeconfig files using subcommands like "kubectl config set current-context my-context" diff --git a/pkg/kubectl/cmd/config/create_authinfo.go b/pkg/kubectl/cmd/config/create_authinfo.go index 7430a7c0bc4..368d47c0fb3 100644 --- a/pkg/kubectl/cmd/config/create_authinfo.go +++ b/pkg/kubectl/cmd/config/create_authinfo.go @@ -100,7 +100,8 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess clientcmd.ConfigAccess) func newCmdConfigSetAuthInfo(out io.Writer, options *createAuthInfoOptions) *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"), Long: create_authinfo_long, Example: create_authinfo_example, diff --git a/pkg/kubectl/cmd/config/create_cluster.go b/pkg/kubectl/cmd/config/create_cluster.go index 2b4a47a1d84..f1f2d091bca 100644 --- a/pkg/kubectl/cmd/config/create_cluster.go +++ b/pkg/kubectl/cmd/config/create_cluster.go @@ -63,7 +63,8 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess clientcmd.ConfigAccess) options := &createClusterOptions{configAccess: configAccess} 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"), Long: create_cluster_long, Example: create_cluster_example, diff --git a/pkg/kubectl/cmd/config/create_context.go b/pkg/kubectl/cmd/config/create_context.go index e3351488c06..d5231729165 100644 --- a/pkg/kubectl/cmd/config/create_context.go +++ b/pkg/kubectl/cmd/config/create_context.go @@ -54,7 +54,8 @@ func NewCmdConfigSetContext(out io.Writer, configAccess clientcmd.ConfigAccess) options := &createContextOptions{configAccess: configAccess} 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"), Long: create_context_long, Example: create_context_example, diff --git a/pkg/kubectl/cmd/config/delete_cluster.go b/pkg/kubectl/cmd/config/delete_cluster.go index 136524a8fc3..a9e00ce8348 100644 --- a/pkg/kubectl/cmd/config/delete_cluster.go +++ b/pkg/kubectl/cmd/config/delete_cluster.go @@ -35,7 +35,8 @@ var ( func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAccess) *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"), Long: "Delete the specified cluster from the kubeconfig", Example: delete_cluster_example, diff --git a/pkg/kubectl/cmd/config/delete_context.go b/pkg/kubectl/cmd/config/delete_context.go index 6d834841c76..d6dad310221 100644 --- a/pkg/kubectl/cmd/config/delete_context.go +++ b/pkg/kubectl/cmd/config/delete_context.go @@ -35,7 +35,8 @@ var ( func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.ConfigAccess) *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"), Long: "Delete the specified context from the kubeconfig", Example: delete_context_example, diff --git a/pkg/kubectl/cmd/config/get_contexts.go b/pkg/kubectl/cmd/config/get_contexts.go index b018a52dca5..b392bdb3961 100644 --- a/pkg/kubectl/cmd/config/get_contexts.go +++ b/pkg/kubectl/cmd/config/get_contexts.go @@ -61,7 +61,8 @@ func NewCmdConfigGetContexts(out io.Writer, configAccess clientcmd.ConfigAccess) options := &GetContextsOptions{configAccess: configAccess} 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"), Long: getContextsLong, Example: getContextsExample, diff --git a/pkg/kubectl/cmd/config/rename_context.go b/pkg/kubectl/cmd/config/rename_context.go index 3216a7c83ea..b5fc2e728de 100644 --- a/pkg/kubectl/cmd/config/rename_context.go +++ b/pkg/kubectl/cmd/config/rename_context.go @@ -61,7 +61,8 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces options := &RenameContextOptions{configAccess: configAccess} cmd := &cobra.Command{ - Use: renameContextUse, + Use: renameContextUse, + DisableFlagsInUseLine: true, Short: renameContextShort, Long: renameContextLong, Example: renameContextExample, diff --git a/pkg/kubectl/cmd/config/set.go b/pkg/kubectl/cmd/config/set.go index 03f97580a08..4374b74b201 100644 --- a/pkg/kubectl/cmd/config/set.go +++ b/pkg/kubectl/cmd/config/set.go @@ -56,7 +56,8 @@ func NewCmdConfigSet(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra. options := &setOptions{configAccess: configAccess} 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"), Long: set_long, Run: func(cmd *cobra.Command, args []string) { diff --git a/pkg/kubectl/cmd/config/unset.go b/pkg/kubectl/cmd/config/unset.go index 3d62038301b..201c6f9d313 100644 --- a/pkg/kubectl/cmd/config/unset.go +++ b/pkg/kubectl/cmd/config/unset.go @@ -44,7 +44,8 @@ func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobr options := &unsetOptions{configAccess: configAccess} cmd := &cobra.Command{ - Use: "unset PROPERTY_NAME", + Use: "unset PROPERTY_NAME", + DisableFlagsInUseLine: true, Short: i18n.T("Unsets an individual value in a kubeconfig file"), Long: unset_long, Run: func(cmd *cobra.Command, args []string) { diff --git a/pkg/kubectl/cmd/config/use_context.go b/pkg/kubectl/cmd/config/use_context.go index 38f77eea2c3..f19a92cce0d 100644 --- a/pkg/kubectl/cmd/config/use_context.go +++ b/pkg/kubectl/cmd/config/use_context.go @@ -45,7 +45,8 @@ func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess) options := &useContextOptions{configAccess: configAccess} 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"), Aliases: []string{"use"}, Long: `Sets the current-context in a kubeconfig file`, diff --git a/pkg/kubectl/cmd/convert.go b/pkg/kubectl/cmd/convert.go index 285b726011d..aa5b31cdb1c 100644 --- a/pkg/kubectl/cmd/convert.go +++ b/pkg/kubectl/cmd/convert.go @@ -65,7 +65,8 @@ func NewCmdConvert(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &ConvertOptions{} cmd := &cobra.Command{ - Use: "convert -f FILENAME", + Use: "convert -f FILENAME", + DisableFlagsInUseLine: true, Short: i18n.T("Convert config files between different API versions"), Long: convert_long, Example: convert_example, diff --git a/pkg/kubectl/cmd/cp.go b/pkg/kubectl/cmd/cp.go index a5d67de3f96..acbb2eff38a 100644 --- a/pkg/kubectl/cmd/cp.go +++ b/pkg/kubectl/cmd/cp.go @@ -64,7 +64,8 @@ var ( // NewCmdCp creates a new Copy command. func NewCmdCp(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "cp ", + Use: "cp ", + DisableFlagsInUseLine: true, Short: i18n.T("Copy files and directories to and from containers."), Long: "Copy files and directories to and from containers.", Example: cpExample, diff --git a/pkg/kubectl/cmd/create.go b/pkg/kubectl/cmd/create.go index 5c00d69acd3..b23dee7b7c8 100644 --- a/pkg/kubectl/cmd/create.go +++ b/pkg/kubectl/cmd/create.go @@ -65,7 +65,8 @@ func NewCmdCreate(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { var options CreateOptions 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."), Long: createLong, Example: createExample, diff --git a/pkg/kubectl/cmd/create_clusterrole.go b/pkg/kubectl/cmd/create_clusterrole.go index 5ed01ce3c33..8f8db8ccb70 100644 --- a/pkg/kubectl/cmd/create_clusterrole.go +++ b/pkg/kubectl/cmd/create_clusterrole.go @@ -66,7 +66,8 @@ func NewCmdCreateClusterRole(f cmdutil.Factory, cmdOut io.Writer) *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, Long: clusterRoleLong, Example: clusterRoleExample, diff --git a/pkg/kubectl/cmd/create_clusterrolebinding.go b/pkg/kubectl/cmd/create_clusterrolebinding.go index d79a18bea9b..c7ce180c343 100644 --- a/pkg/kubectl/cmd/create_clusterrolebinding.go +++ b/pkg/kubectl/cmd/create_clusterrolebinding.go @@ -39,7 +39,8 @@ var ( // ClusterRoleBinding is a command to ease creating ClusterRoleBindings. func NewCmdCreateClusterRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *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"), Long: clusterRoleBindingLong, Example: clusterRoleBindingExample, diff --git a/pkg/kubectl/cmd/create_configmap.go b/pkg/kubectl/cmd/create_configmap.go index b9f17adede8..cb80b83e9f9 100644 --- a/pkg/kubectl/cmd/create_configmap.go +++ b/pkg/kubectl/cmd/create_configmap.go @@ -60,11 +60,12 @@ var ( // ConfigMap is a command to ease creating ConfigMaps. func NewCmdCreateConfigMap(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", - Aliases: []string{"cm"}, - Short: i18n.T("Create a configmap from a local file, directory or literal value"), - Long: configMapLong, - Example: configMapExample, + Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"cm"}, + Short: i18n.T("Create a configmap from a local file, directory or literal value"), + Long: configMapLong, + Example: configMapExample, Run: func(cmd *cobra.Command, args []string) { err := CreateConfigMap(f, cmdOut, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/create_deployment.go b/pkg/kubectl/cmd/create_deployment.go index 08e1c9dec0d..cde03d1b76c 100644 --- a/pkg/kubectl/cmd/create_deployment.go +++ b/pkg/kubectl/cmd/create_deployment.go @@ -41,11 +41,12 @@ var ( // Note that this command overlaps significantly with the `kubectl run` command. func NewCmdCreateDeployment(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "deployment NAME --image=image [--dry-run]", - Aliases: []string{"deploy"}, - Short: i18n.T("Create a deployment with the specified name."), - Long: deploymentLong, - Example: deploymentExample, + Use: "deployment NAME --image=image [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"deploy"}, + Short: i18n.T("Create a deployment with the specified name."), + Long: deploymentLong, + Example: deploymentExample, Run: func(cmd *cobra.Command, args []string) { err := createDeployment(f, cmdOut, cmdErr, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/create_namespace.go b/pkg/kubectl/cmd/create_namespace.go index 955cf1f84af..7a0f2ec327f 100644 --- a/pkg/kubectl/cmd/create_namespace.go +++ b/pkg/kubectl/cmd/create_namespace.go @@ -39,11 +39,12 @@ var ( // NewCmdCreateNamespace is a macro command to create a new namespace func NewCmdCreateNamespace(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "namespace NAME [--dry-run]", - Aliases: []string{"ns"}, - Short: i18n.T("Create a namespace with the specified name"), - Long: namespaceLong, - Example: namespaceExample, + Use: "namespace NAME [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"ns"}, + Short: i18n.T("Create a namespace with the specified name"), + Long: namespaceLong, + Example: namespaceExample, Run: func(cmd *cobra.Command, args []string) { err := CreateNamespace(f, cmdOut, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/create_pdb.go b/pkg/kubectl/cmd/create_pdb.go index 310a55e275b..39938f64152 100644 --- a/pkg/kubectl/cmd/create_pdb.go +++ b/pkg/kubectl/cmd/create_pdb.go @@ -44,11 +44,12 @@ var ( // NewCmdCreatePodDisruptionBudget is a macro command to create a new pod disruption budget. func NewCmdCreatePodDisruptionBudget(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]", - Aliases: []string{"pdb"}, - Short: i18n.T("Create a pod disruption budget with the specified name."), - Long: pdbLong, - Example: pdbExample, + Use: "poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"pdb"}, + Short: i18n.T("Create a pod disruption budget with the specified name."), + Long: pdbLong, + Example: pdbExample, Run: func(cmd *cobra.Command, args []string) { err := CreatePodDisruptionBudget(f, cmdOut, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/create_priorityclass.go b/pkg/kubectl/cmd/create_priorityclass.go index 7f3561ae614..99c17866732 100644 --- a/pkg/kubectl/cmd/create_priorityclass.go +++ b/pkg/kubectl/cmd/create_priorityclass.go @@ -42,11 +42,12 @@ var ( // NewCmdCreatePriorityClass is a macro command to create a new priorityClass. func NewCmdCreatePriorityClass(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]", - Aliases: []string{"pc"}, - Short: i18n.T("Create a priorityclass with the specified name."), - Long: pcLong, - Example: pcExample, + Use: "priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"pc"}, + Short: i18n.T("Create a priorityclass with the specified name."), + Long: pcLong, + Example: pcExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(CreatePriorityClass(f, cmdOut, cmd, args)) }, diff --git a/pkg/kubectl/cmd/create_quota.go b/pkg/kubectl/cmd/create_quota.go index cbd5dc741d3..48eed9993a1 100644 --- a/pkg/kubectl/cmd/create_quota.go +++ b/pkg/kubectl/cmd/create_quota.go @@ -42,11 +42,12 @@ var ( // NewCmdCreateQuota is a macro command to create a new quota func NewCmdCreateQuota(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]", - Aliases: []string{"resourcequota"}, - Short: i18n.T("Create a quota with the specified name."), - Long: quotaLong, - Example: quotaExample, + Use: "quota NAME [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=bool]", + DisableFlagsInUseLine: true, + Aliases: []string{"resourcequota"}, + Short: i18n.T("Create a quota with the specified name."), + Long: quotaLong, + Example: quotaExample, Run: func(cmd *cobra.Command, args []string) { err := CreateQuota(f, cmdOut, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/create_role.go b/pkg/kubectl/cmd/create_role.go index 0a881e779c7..1710a4de32e 100644 --- a/pkg/kubectl/cmd/create_role.go +++ b/pkg/kubectl/cmd/create_role.go @@ -121,7 +121,8 @@ func NewCmdCreateRole(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { Out: cmdOut, } 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, Long: roleLong, Example: roleExample, diff --git a/pkg/kubectl/cmd/create_rolebinding.go b/pkg/kubectl/cmd/create_rolebinding.go index 35cb8dc02c8..49eca5706f5 100644 --- a/pkg/kubectl/cmd/create_rolebinding.go +++ b/pkg/kubectl/cmd/create_rolebinding.go @@ -39,7 +39,8 @@ var ( // RoleBinding is a command to ease creating RoleBindings. func NewCmdCreateRoleBinding(f cmdutil.Factory, cmdOut io.Writer) *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"), Long: roleBindingLong, Example: roleBindingExample, diff --git a/pkg/kubectl/cmd/create_secret.go b/pkg/kubectl/cmd/create_secret.go index f49048bf9a3..5a5b99015b6 100644 --- a/pkg/kubectl/cmd/create_secret.go +++ b/pkg/kubectl/cmd/create_secret.go @@ -76,7 +76,8 @@ var ( // NewCmdCreateSecretGeneric is a command to create generic secrets from files, directories, or literal values func NewCmdCreateSecretGeneric(f cmdutil.Factory, cmdOut io.Writer) *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"), Long: secretLong, Example: secretExample, @@ -149,7 +150,8 @@ var ( // NewCmdCreateSecretDockerRegistry is a macro command for creating secrets to work with Docker registries func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, cmdOut io.Writer) *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"), Long: secretForDockerRegistryLong, Example: secretForDockerRegistryExample, @@ -223,7 +225,8 @@ var ( // NewCmdCreateSecretTLS is a macro command for creating secrets to work with Docker registries func NewCmdCreateSecretTLS(f cmdutil.Factory, cmdOut io.Writer) *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"), Long: secretForTLSLong, Example: secretForTLSExample, diff --git a/pkg/kubectl/cmd/create_service.go b/pkg/kubectl/cmd/create_service.go index 52496a03b5e..a35d210de27 100644 --- a/pkg/kubectl/cmd/create_service.go +++ b/pkg/kubectl/cmd/create_service.go @@ -64,7 +64,8 @@ func addPortFlags(cmd *cobra.Command) { // NewCmdCreateServiceClusterIP is a command to create a ClusterIP service func NewCmdCreateServiceClusterIP(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "clusterip NAME [--tcp=:] [--dry-run]", + Use: "clusterip NAME [--tcp=:] [--dry-run]", + DisableFlagsInUseLine: true, Short: i18n.T("Create a ClusterIP service."), Long: serviceClusterIPLong, Example: serviceClusterIPExample, @@ -124,7 +125,8 @@ var ( // NewCmdCreateServiceNodePort is a macro command for creating a NodePort service func NewCmdCreateServiceNodePort(f cmdutil.Factory, cmdOut io.Writer) *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."), Long: serviceNodePortLong, Example: serviceNodePortExample, @@ -181,7 +183,8 @@ var ( // NewCmdCreateServiceLoadBalancer is a macro command for creating a LoadBalancer service func NewCmdCreateServiceLoadBalancer(f cmdutil.Factory, cmdOut io.Writer) *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."), Long: serviceLoadBalancerLong, Example: serviceLoadBalancerExample, @@ -240,7 +243,8 @@ var ( // NewCmdCreateServiceExternalName is a macro command for creating an ExternalName service func NewCmdCreateServiceExternalName(f cmdutil.Factory, cmdOut io.Writer) *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."), Long: serviceExternalNameLong, Example: serviceExternalNameExample, diff --git a/pkg/kubectl/cmd/create_serviceaccount.go b/pkg/kubectl/cmd/create_serviceaccount.go index 99dfde9dd1a..c4302c64cc7 100644 --- a/pkg/kubectl/cmd/create_serviceaccount.go +++ b/pkg/kubectl/cmd/create_serviceaccount.go @@ -39,11 +39,12 @@ var ( // NewCmdCreateServiceAccount is a macro command to create a new service account func NewCmdCreateServiceAccount(f cmdutil.Factory, cmdOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "serviceaccount NAME [--dry-run]", - Aliases: []string{"sa"}, - Short: i18n.T("Create a service account with the specified name"), - Long: serviceAccountLong, - Example: serviceAccountExample, + Use: "serviceaccount NAME [--dry-run]", + DisableFlagsInUseLine: true, + Aliases: []string{"sa"}, + Short: i18n.T("Create a service account with the specified name"), + Long: serviceAccountLong, + Example: serviceAccountExample, Run: func(cmd *cobra.Command, args []string) { err := CreateServiceAccount(f, cmdOut, cmd, args) cmdutil.CheckErr(err) diff --git a/pkg/kubectl/cmd/delete.go b/pkg/kubectl/cmd/delete.go index 80a9bd49920..60ac7d5b43c 100644 --- a/pkg/kubectl/cmd/delete.go +++ b/pkg/kubectl/cmd/delete.go @@ -127,7 +127,8 @@ func NewCmdDelete(f cmdutil.Factory, out, errOut io.Writer) *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"), Long: delete_long, Example: delete_example, diff --git a/pkg/kubectl/cmd/delete_test.go b/pkg/kubectl/cmd/delete_test.go index 5b78ba09761..220dd288909 100644 --- a/pkg/kubectl/cmd/delete_test.go +++ b/pkg/kubectl/cmd/delete_test.go @@ -44,6 +44,7 @@ var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer var fakecmd = &cobra.Command{ Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])", + DisableFlagsInUseLine: true, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) }, diff --git a/pkg/kubectl/cmd/describe.go b/pkg/kubectl/cmd/describe.go index f77304ec599..f1b75ccd0e6 100644 --- a/pkg/kubectl/cmd/describe.go +++ b/pkg/kubectl/cmd/describe.go @@ -79,7 +79,8 @@ func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: describeLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Example: describeExample, diff --git a/pkg/kubectl/cmd/describe_test.go b/pkg/kubectl/cmd/describe_test.go index 2c3ec49c5c8..5c068609d35 100644 --- a/pkg/kubectl/cmd/describe_test.go +++ b/pkg/kubectl/cmd/describe_test.go @@ -20,6 +20,7 @@ import ( "bytes" "fmt" "net/http" + "strings" "testing" "k8s.io/client-go/rest/fake" @@ -168,3 +169,30 @@ func TestDescribeObjectSkipEvents(t *testing.T) { 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) + } +} diff --git a/pkg/kubectl/cmd/diff.go b/pkg/kubectl/cmd/diff.go index e536069952d..422ec70dc36 100644 --- a/pkg/kubectl/cmd/diff.go +++ b/pkg/kubectl/cmd/diff.go @@ -109,7 +109,8 @@ func NewCmdDiff(f cmdutil.Factory, stdout, stderr io.Writer) *cobra.Command { Stderr: stderr, } cmd := &cobra.Command{ - Use: "diff -f FILENAME", + Use: "diff -f FILENAME", + DisableFlagsInUseLine: true, Short: i18n.T("Diff different versions of configurations"), Long: diffLong, Example: diffExample, diff --git a/pkg/kubectl/cmd/drain.go b/pkg/kubectl/cmd/drain.go index ba5ae1f1a72..3226d54a646 100644 --- a/pkg/kubectl/cmd/drain.go +++ b/pkg/kubectl/cmd/drain.go @@ -105,7 +105,8 @@ func NewCmdCordon(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &DrainOptions{Factory: f, Out: out} cmd := &cobra.Command{ - Use: "cordon NODE", + Use: "cordon NODE", + DisableFlagsInUseLine: true, Short: i18n.T("Mark node as unschedulable"), Long: cordon_long, Example: cordon_example, @@ -132,7 +133,8 @@ func NewCmdUncordon(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &DrainOptions{Factory: f, Out: out} cmd := &cobra.Command{ - Use: "uncordon NODE", + Use: "uncordon NODE", + DisableFlagsInUseLine: true, Short: i18n.T("Mark node as schedulable"), Long: uncordon_long, Example: uncordon_example, @@ -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()} cmd := &cobra.Command{ - Use: "drain NODE", + Use: "drain NODE", + DisableFlagsInUseLine: true, Short: i18n.T("Drain node in preparation for maintenance"), Long: drain_long, Example: drain_example, diff --git a/pkg/kubectl/cmd/edit.go b/pkg/kubectl/cmd/edit.go index 11ef23c6bd5..1883c11895c 100644 --- a/pkg/kubectl/cmd/edit.go +++ b/pkg/kubectl/cmd/edit.go @@ -87,7 +87,8 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *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"), Long: editLong, Example: fmt.Sprintf(editExample), diff --git a/pkg/kubectl/cmd/exec.go b/pkg/kubectl/cmd/exec.go index cca3d61a928..e13675029bb 100644 --- a/pkg/kubectl/cmd/exec.go +++ b/pkg/kubectl/cmd/exec.go @@ -73,7 +73,8 @@ func NewCmdExec(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *c Executor: &DefaultRemoteExecutor{}, } 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"), Long: "Execute a command in a container.", Example: exec_example, diff --git a/pkg/kubectl/cmd/explain.go b/pkg/kubectl/cmd/explain.go index d1ecf3d65d4..47472c3c466 100644 --- a/pkg/kubectl/cmd/explain.go +++ b/pkg/kubectl/cmd/explain.go @@ -53,7 +53,8 @@ var ( // NewCmdExplain returns a cobra command for swagger docs func NewCmdExplain(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "explain RESOURCE", + Use: "explain RESOURCE", + DisableFlagsInUseLine: true, Short: i18n.T("Documentation of resources"), Long: explainLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Example: explainExamples, diff --git a/pkg/kubectl/cmd/expose.go b/pkg/kubectl/cmd/expose.go index ed84c1d76b7..51ccd43225d 100644 --- a/pkg/kubectl/cmd/expose.go +++ b/pkg/kubectl/cmd/expose.go @@ -83,7 +83,8 @@ func NewCmdExposeService(f cmdutil.Factory, out io.Writer) *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"), Long: exposeLong, Example: exposeExample, diff --git a/pkg/kubectl/cmd/help.go b/pkg/kubectl/cmd/help.go index 569abb9fd88..783a87c64db 100644 --- a/pkg/kubectl/cmd/help.go +++ b/pkg/kubectl/cmd/help.go @@ -31,7 +31,8 @@ var helpLong = templates.LongDesc(i18n.T(` func NewCmdHelp() *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"), Long: helpLong, diff --git a/pkg/kubectl/cmd/label.go b/pkg/kubectl/cmd/label.go index 786fbe6afcb..32574853234 100644 --- a/pkg/kubectl/cmd/label.go +++ b/pkg/kubectl/cmd/label.go @@ -111,7 +111,8 @@ func NewCmdLabel(f cmdutil.Factory, out io.Writer) *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"), Long: fmt.Sprintf(labelLong, validation.LabelValueMaxLength), Example: labelExample, diff --git a/pkg/kubectl/cmd/logs.go b/pkg/kubectl/cmd/logs.go index cccceb154bc..8091cf8251a 100644 --- a/pkg/kubectl/cmd/logs.go +++ b/pkg/kubectl/cmd/logs.go @@ -89,7 +89,8 @@ type LogsOptions struct { func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command { o := &LogsOptions{} 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"), 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, diff --git a/pkg/kubectl/cmd/patch.go b/pkg/kubectl/cmd/patch.go index 325c2584722..daf67ef56bb 100644 --- a/pkg/kubectl/cmd/patch.go +++ b/pkg/kubectl/cmd/patch.go @@ -95,7 +95,8 @@ func NewCmdPatch(f cmdutil.Factory, out io.Writer) *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"), Long: patchLong, Example: patchExample, diff --git a/pkg/kubectl/cmd/plugin.go b/pkg/kubectl/cmd/plugin.go index b69e7a89c68..d34e78733a4 100644 --- a/pkg/kubectl/cmd/plugin.go +++ b/pkg/kubectl/cmd/plugin.go @@ -50,7 +50,8 @@ func NewCmdPlugin(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Co } cmd := &cobra.Command{ - Use: "plugin NAME", + Use: "plugin NAME", + DisableFlagsInUseLine: true, Short: i18n.T("Runs a command-line plugin"), Long: plugin_long, Run: func(cmd *cobra.Command, args []string) { diff --git a/pkg/kubectl/cmd/portforward.go b/pkg/kubectl/cmd/portforward.go index cedb93bb232..cf39bf637ab 100644 --- a/pkg/kubectl/cmd/portforward.go +++ b/pkg/kubectl/cmd/portforward.go @@ -70,7 +70,8 @@ func NewCmdPortForward(f cmdutil.Factory, cmdOut, cmdErr io.Writer) *cobra.Comma }, } 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"), Long: "Forward one or more local ports to a pod.", Example: portforwardExample, diff --git a/pkg/kubectl/cmd/proxy.go b/pkg/kubectl/cmd/proxy.go index 7bc82ec7f45..027dfbf1ee8 100644 --- a/pkg/kubectl/cmd/proxy.go +++ b/pkg/kubectl/cmd/proxy.go @@ -71,7 +71,8 @@ var ( func NewCmdProxy(f cmdutil.Factory, out io.Writer) *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"), Long: proxyLong, Example: proxyExample, diff --git a/pkg/kubectl/cmd/replace.go b/pkg/kubectl/cmd/replace.go index 16b80ae3247..fe75e2b211b 100644 --- a/pkg/kubectl/cmd/replace.go +++ b/pkg/kubectl/cmd/replace.go @@ -64,7 +64,8 @@ func NewCmdReplace(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &resource.FilenameOptions{} cmd := &cobra.Command{ - Use: "replace -f FILENAME", + Use: "replace -f FILENAME", + DisableFlagsInUseLine: true, Short: i18n.T("Replace a resource by filename or stdin"), Long: replaceLong, Example: replaceExample, diff --git a/pkg/kubectl/cmd/resource/get.go b/pkg/kubectl/cmd/resource/get.go index 4013cb42874..386c1eb97ac 100644 --- a/pkg/kubectl/cmd/resource/get.go +++ b/pkg/kubectl/cmd/resource/get.go @@ -139,7 +139,8 @@ func NewCmdGet(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Comman } 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"), Long: getLong + "\n\n" + cmdutil.ValidResourceTypeList(f), Example: getExample, diff --git a/pkg/kubectl/cmd/rollingupdate.go b/pkg/kubectl/cmd/rollingupdate.go index 117cacbfb10..e27037e6662 100644 --- a/pkg/kubectl/cmd/rollingupdate.go +++ b/pkg/kubectl/cmd/rollingupdate.go @@ -79,7 +79,8 @@ func NewCmdRollingUpdate(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &resource.FilenameOptions{} 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"), Long: rollingUpdateLong, Example: rollingUpdateExample, @@ -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".`) usage := "Filename or URL to file to use to create the new replication controller." 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.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("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.")) diff --git a/pkg/kubectl/cmd/rollout/rollout.go b/pkg/kubectl/cmd/rollout/rollout.go index a65ed4d8df5..941b585c11d 100644 --- a/pkg/kubectl/cmd/rollout/rollout.go +++ b/pkg/kubectl/cmd/rollout/rollout.go @@ -49,7 +49,8 @@ var ( func NewCmdRollout(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "rollout SUBCOMMAND", + Use: "rollout SUBCOMMAND", + DisableFlagsInUseLine: true, Short: i18n.T("Manage the rollout of a resource"), Long: rollout_long, Example: rollout_example, diff --git a/pkg/kubectl/cmd/rollout/rollout_history.go b/pkg/kubectl/cmd/rollout/rollout_history.go index 91b5711f1d2..fb6ccbe90e7 100644 --- a/pkg/kubectl/cmd/rollout/rollout_history.go +++ b/pkg/kubectl/cmd/rollout/rollout_history.go @@ -48,7 +48,8 @@ func NewCmdRolloutHistory(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: history_long, Example: history_example, diff --git a/pkg/kubectl/cmd/rollout/rollout_pause.go b/pkg/kubectl/cmd/rollout/rollout_pause.go index 5a9f3bd4b7f..17b8d3e80ce 100644 --- a/pkg/kubectl/cmd/rollout/rollout_pause.go +++ b/pkg/kubectl/cmd/rollout/rollout_pause.go @@ -71,7 +71,8 @@ func NewCmdRolloutPause(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) cmd := &cobra.Command{ - Use: "pause RESOURCE", + Use: "pause RESOURCE", + DisableFlagsInUseLine: true, Short: i18n.T("Mark the provided resource as paused"), Long: pause_long, Example: pause_example, diff --git a/pkg/kubectl/cmd/rollout/rollout_resume.go b/pkg/kubectl/cmd/rollout/rollout_resume.go index 427fac9acfa..3e0d07e9c77 100644 --- a/pkg/kubectl/cmd/rollout/rollout_resume.go +++ b/pkg/kubectl/cmd/rollout/rollout_resume.go @@ -69,7 +69,8 @@ func NewCmdRolloutResume(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) cmd := &cobra.Command{ - Use: "resume RESOURCE", + Use: "resume RESOURCE", + DisableFlagsInUseLine: true, Short: i18n.T("Resume a paused resource"), Long: resume_long, Example: resume_example, diff --git a/pkg/kubectl/cmd/rollout/rollout_status.go b/pkg/kubectl/cmd/rollout/rollout_status.go index 6655c7c92f5..4abf6b4ee9e 100644 --- a/pkg/kubectl/cmd/rollout/rollout_status.go +++ b/pkg/kubectl/cmd/rollout/rollout_status.go @@ -54,7 +54,8 @@ func NewCmdRolloutStatus(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: status_long, Example: status_example, diff --git a/pkg/kubectl/cmd/rollout/rollout_undo.go b/pkg/kubectl/cmd/rollout/rollout_undo.go index fb5c7dc09cc..3eb40ea42a4 100644 --- a/pkg/kubectl/cmd/rollout/rollout_undo.go +++ b/pkg/kubectl/cmd/rollout/rollout_undo.go @@ -69,7 +69,8 @@ func NewCmdRolloutUndo(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: undo_long, Example: undo_example, diff --git a/pkg/kubectl/cmd/run.go b/pkg/kubectl/cmd/run.go index 087e8d40b85..516624e8666 100644 --- a/pkg/kubectl/cmd/run.go +++ b/pkg/kubectl/cmd/run.go @@ -96,7 +96,8 @@ type RunObject struct { func NewCmdRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *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"), Long: runLong, Example: runExample, diff --git a/pkg/kubectl/cmd/scale.go b/pkg/kubectl/cmd/scale.go index be722abc962..90233f499f6 100644 --- a/pkg/kubectl/cmd/scale.go +++ b/pkg/kubectl/cmd/scale.go @@ -64,7 +64,8 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: scaleLong, Example: scaleExample, diff --git a/pkg/kubectl/cmd/set/set.go b/pkg/kubectl/cmd/set/set.go index e905c3fb5b7..dfc69c1049d 100644 --- a/pkg/kubectl/cmd/set/set.go +++ b/pkg/kubectl/cmd/set/set.go @@ -34,7 +34,8 @@ var ( func NewCmdSet(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Command { cmd := &cobra.Command{ - Use: "set SUBCOMMAND", + Use: "set SUBCOMMAND", + DisableFlagsInUseLine: true, Short: i18n.T("Set specific features on objects"), Long: set_long, Run: cmdutil.DefaultSubCommandRun(err), diff --git a/pkg/kubectl/cmd/set/set_env.go b/pkg/kubectl/cmd/set/set_env.go index 36c3b810050..bb7234dbbb7 100644 --- a/pkg/kubectl/cmd/set/set_env.go +++ b/pkg/kubectl/cmd/set/set_env.go @@ -135,7 +135,8 @@ func NewCmdEnv(f cmdutil.Factory, in io.Reader, out, errout io.Writer) *cobra.Co In: in, } 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", Long: envLong, Example: fmt.Sprintf(envExample), diff --git a/pkg/kubectl/cmd/set/set_image.go b/pkg/kubectl/cmd/set/set_image.go index 09bff8302ee..4f940cf8804 100644 --- a/pkg/kubectl/cmd/set/set_image.go +++ b/pkg/kubectl/cmd/set/set_image.go @@ -92,7 +92,8 @@ func NewCmdImage(f cmdutil.Factory, out, err io.Writer) *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"), Long: image_long, Example: image_example, diff --git a/pkg/kubectl/cmd/set/set_resources.go b/pkg/kubectl/cmd/set/set_resources.go index 5284e52ac58..a6b85994f2a 100644 --- a/pkg/kubectl/cmd/set/set_resources.go +++ b/pkg/kubectl/cmd/set/set_resources.go @@ -98,7 +98,8 @@ func NewCmdResources(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra. } 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"), Long: fmt.Sprintf(resources_long, strings.Join(resourceTypesWithPodTemplate, ", ")), Example: resources_example, diff --git a/pkg/kubectl/cmd/set/set_selector.go b/pkg/kubectl/cmd/set/set_selector.go index 3579f63cf4b..8dca8f45751 100644 --- a/pkg/kubectl/cmd/set/set_selector.go +++ b/pkg/kubectl/cmd/set/set_selector.go @@ -79,7 +79,8 @@ func NewCmdSelector(f cmdutil.Factory, out io.Writer) *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"), Long: fmt.Sprintf(selectorLong, validation.LabelValueMaxLength), Example: selectorExample, diff --git a/pkg/kubectl/cmd/set/set_serviceaccount.go b/pkg/kubectl/cmd/set/set_serviceaccount.go index 65ac0d166c3..535fd32b64b 100644 --- a/pkg/kubectl/cmd/set/set_serviceaccount.go +++ b/pkg/kubectl/cmd/set/set_serviceaccount.go @@ -83,11 +83,12 @@ func NewCmdServiceAccount(f cmdutil.Factory, out, err io.Writer) *cobra.Command } cmd := &cobra.Command{ - Use: "serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT", - Aliases: []string{"sa"}, - Short: i18n.T("Update ServiceAccount of a resource"), - Long: serviceaccountLong, - Example: serviceaccountExample, + Use: "serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT", + DisableFlagsInUseLine: true, + Aliases: []string{"sa"}, + Short: i18n.T("Update ServiceAccount of a resource"), + Long: serviceaccountLong, + Example: serviceaccountExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(saConfig.Complete(f, cmd, args)) cmdutil.CheckErr(saConfig.Run()) diff --git a/pkg/kubectl/cmd/set/set_subject.go b/pkg/kubectl/cmd/set/set_subject.go index c71a664b00e..3e8c204de65 100644 --- a/pkg/kubectl/cmd/set/set_subject.go +++ b/pkg/kubectl/cmd/set/set_subject.go @@ -84,7 +84,8 @@ func NewCmdSubject(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Co } 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"), Long: subject_long, Example: subject_example, diff --git a/pkg/kubectl/cmd/taint.go b/pkg/kubectl/cmd/taint.go index 239aba71634..9ef8bc10c14 100644 --- a/pkg/kubectl/cmd/taint.go +++ b/pkg/kubectl/cmd/taint.go @@ -85,7 +85,8 @@ func NewCmdTaint(f cmdutil.Factory, out io.Writer) *cobra.Command { argAliases := kubectl.ResourceAliases(validArgs) 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"), Long: fmt.Sprintf(taintLong, validation.DNS1123SubdomainMaxLength, validation.LabelValueMaxLength), Example: taintExample, diff --git a/pkg/kubectl/cmd/top_node.go b/pkg/kubectl/cmd/top_node.go index dace2918d69..610a542b7f3 100644 --- a/pkg/kubectl/cmd/top_node.go +++ b/pkg/kubectl/cmd/top_node.go @@ -89,7 +89,8 @@ func NewCmdTopNode(f cmdutil.Factory, options *TopNodeOptions, out io.Writer) *c } 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"), Long: topNodeLong, Example: topNodeExample, diff --git a/pkg/kubectl/cmd/top_pod.go b/pkg/kubectl/cmd/top_pod.go index 2ffdc6dff8e..669f95cd3cf 100644 --- a/pkg/kubectl/cmd/top_pod.go +++ b/pkg/kubectl/cmd/top_pod.go @@ -78,7 +78,8 @@ func NewCmdTopPod(f cmdutil.Factory, options *TopPodOptions, out io.Writer) *cob } 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"), Long: topPodLong, Example: topPodExample,