mirror of https://github.com/k3s-io/k3s
code cleanup for kubectl config
parent
5252352ad8
commit
672cad60e9
|
@ -52,8 +52,7 @@ func NewCmdConfigCurrentContext(out io.Writer, configAccess clientcmd.ConfigAcce
|
|||
Long: currentContextLong,
|
||||
Example: currentContextExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := RunCurrentContext(out, options)
|
||||
cmdutil.CheckErr(err)
|
||||
cmdutil.CheckErr(RunCurrentContext(out, options))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAcces
|
|||
Long: "Delete the specified cluster from the kubeconfig",
|
||||
Example: deleteClusterExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := runDeleteCluster(out, configAccess, cmd)
|
||||
cmdutil.CheckErr(err)
|
||||
cmdutil.CheckErr(runDeleteCluster(out, configAccess, cmd))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.Con
|
|||
Long: "Delete the specified context from the kubeconfig",
|
||||
Example: deleteContextExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := runDeleteContext(out, errOut, configAccess, cmd)
|
||||
cmdutil.CheckErr(err)
|
||||
cmdutil.CheckErr(runDeleteContext(out, errOut, configAccess, cmd))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess)
|
|||
Long: "Display clusters defined in the kubeconfig.",
|
||||
Example: getClustersExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := runGetClusters(out, configAccess)
|
||||
cmdutil.CheckErr(err)
|
||||
cmdutil.CheckErr(runGetClusters(out, configAccess))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -67,15 +67,9 @@ func NewCmdConfigRenameContext(out io.Writer, configAccess clientcmd.ConfigAcces
|
|||
Long: renameContextLong,
|
||||
Example: renameContextExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if err := options.Complete(cmd, args, out); err != nil {
|
||||
cmdutil.CheckErr(err)
|
||||
}
|
||||
if err := options.Validate(); err != nil {
|
||||
cmdutil.CheckErr(cmdutil.UsageErrorf(cmd, err.Error()))
|
||||
}
|
||||
if err := options.RunRenameContext(out); err != nil {
|
||||
cmdutil.CheckErr(err)
|
||||
}
|
||||
cmdutil.CheckErr(options.Complete(cmd, args, out))
|
||||
cmdutil.CheckErr(options.Validate())
|
||||
cmdutil.CheckErr(options.RunRenameContext(out))
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
|
|
Loading…
Reference in New Issue