mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #55516 from zjj2wry/config-unset
Automatic merge from submit-queue (batch tested with PRs 59158, 38320, 59059, 55516, 59357). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. add example for kubectl config unset, this will help user use **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
3021aa224c
@ -35,11 +35,20 @@ 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}
|
||||
|
||||
@ -47,7 +56,8 @@ func NewCmdConfigUnset(out io.Writer, configAccess clientcmd.ConfigAccess) *cobr
|
||||
Use: "unset PROPERTY_NAME",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Unsets an individual value in a kubeconfig file"),
|
||||
Long: unset_long,
|
||||
Long: unsetLong,
|
||||
Example: unsetExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(options.complete(cmd, args))
|
||||
cmdutil.CheckErr(options.run(out))
|
||||
|
Loading…
Reference in New Issue
Block a user