mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 03:38:15 +00:00
Improve kubectl help with examples.
This commit is contained in:
@@ -25,9 +25,16 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
)
|
||||
|
||||
var (
|
||||
use_context_example = templates.Examples(`
|
||||
# Use the context for the minikube cluster
|
||||
kubectl config use-context minikube`)
|
||||
)
|
||||
|
||||
type useContextOptions struct {
|
||||
configAccess clientcmd.ConfigAccess
|
||||
contextName string
|
||||
@@ -37,9 +44,10 @@ func NewCmdConfigUseContext(out io.Writer, configAccess clientcmd.ConfigAccess)
|
||||
options := &useContextOptions{configAccess: configAccess}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "use-context CONTEXT_NAME",
|
||||
Short: "Sets the current-context in a kubeconfig file",
|
||||
Long: `Sets the current-context in a kubeconfig file`,
|
||||
Use: "use-context CONTEXT_NAME",
|
||||
Short: "Sets the current-context in a kubeconfig file",
|
||||
Long: `Sets the current-context in a kubeconfig file`,
|
||||
Example: use_context_example,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if !options.complete(cmd) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user