diff --git a/pkg/kubectl/cmd/config/unset.go b/pkg/kubectl/cmd/config/unset.go index 201c6f9d313..18345cd4914 100644 --- a/pkg/kubectl/cmd/config/unset.go +++ b/pkg/kubectl/cmd/config/unset.go @@ -35,19 +35,29 @@ type unsetOptions struct { propertyName string } -var unset_long = templates.LongDesc(` +var ( + unsetLong = templates.LongDesc(` Unsets an individual value in a kubeconfig file PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.`) + unsetExample = templates.Examples(` + # Unset the current-context. + kubectl config unset current-context + + # Unset namespace in foo context. + kubectl config unset contexts.foo.namespace`) +) + func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobra.Command { options := &unsetOptions{configAccess: configAccess} cmd := &cobra.Command{ Use: "unset PROPERTY_NAME", DisableFlagsInUseLine: true, - Short: i18n.T("Unsets an individual value in a kubeconfig file"), - Long: unset_long, + Short: i18n.T("Unsets an individual value in a kubeconfig file"), + Long: unsetLong, + Example: unsetExample, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(options.complete(cmd, args)) cmdutil.CheckErr(options.run(out))