diff --git a/docs/man/man1/kubectl-config-view.1 b/docs/man/man1/kubectl-config-view.1 index 5ada9c8bb33..abf2675bf3b 100644 --- a/docs/man/man1/kubectl-config-view.1 +++ b/docs/man/man1/kubectl-config-view.1 @@ -3,7 +3,7 @@ .SH NAME .PP -kubectl config view \- displays Merged kubeconfig settings or a specified kubeconfig file. +kubectl config view \- Displays merged kubeconfig settings or a specified kubeconfig file. .SH SYNOPSIS @@ -13,7 +13,7 @@ kubectl config view \- displays Merged kubeconfig settings or a specified kubeco .SH DESCRIPTION .PP -displays Merged kubeconfig settings or a specified kubeconfig file. +Displays merged kubeconfig settings or a specified kubeconfig file. .PP You can use \-\-output=template \-\-template=TEMPLATE to extract specific values. diff --git a/docs/user-guide/kubectl/kubectl_config.md b/docs/user-guide/kubectl/kubectl_config.md index f0eb708b869..b1aa25fb8b9 100644 --- a/docs/user-guide/kubectl/kubectl_config.md +++ b/docs/user-guide/kubectl/kubectl_config.md @@ -92,9 +92,9 @@ kubectl config SUBCOMMAND * [kubectl config set-credentials](kubectl_config_set-credentials.md) - Sets a user entry in kubeconfig * [kubectl config unset](kubectl_config_unset.md) - Unsets an individual value in a kubeconfig file * [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a kubeconfig file -* [kubectl config view](kubectl_config_view.md) - displays Merged kubeconfig settings or a specified kubeconfig file. +* [kubectl config view](kubectl_config_view.md) - Displays merged kubeconfig settings or a specified kubeconfig file. -###### Auto generated by spf13/cobra at 2015-09-10 18:53:03.163685546 +0000 UTC +###### Auto generated by spf13/cobra at 2015-09-23 08:09:58.253683538 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_view.md b/docs/user-guide/kubectl/kubectl_config_view.md index 2153266a154..8490d7482a0 100644 --- a/docs/user-guide/kubectl/kubectl_config_view.md +++ b/docs/user-guide/kubectl/kubectl_config_view.md @@ -33,12 +33,12 @@ Documentation for other releases can be found at ## kubectl config view -displays Merged kubeconfig settings or a specified kubeconfig file. +Displays merged kubeconfig settings or a specified kubeconfig file. ### Synopsis -displays Merged kubeconfig settings or a specified kubeconfig file. +Displays merged kubeconfig settings or a specified kubeconfig file. You can use --output=template --template=TEMPLATE to extract specific values. @@ -103,7 +103,7 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2 * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-09-10 18:53:03.161359997 +0000 UTC +###### Auto generated by spf13/cobra at 2015-09-23 08:09:58.252744701 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_view.md?pixel)]() diff --git a/pkg/kubectl/cmd/config/config_test.go b/pkg/kubectl/cmd/config/config_test.go index 3fe325e5e04..eb7401fa8f8 100644 --- a/pkg/kubectl/cmd/config/config_test.go +++ b/pkg/kubectl/cmd/config/config_test.go @@ -101,7 +101,7 @@ func TestSetNonExistentContext(t *testing.T) { args: []string{"use-context", "non-existent-config"}, startingConfig: expectedConfig, expectedConfig: expectedConfig, - expectedOutputs: []string{`No context exists with the name: "non-existent-config"`}, + expectedOutputs: []string{`no context exists with the name: "non-existent-config"`}, } test.run(t) } diff --git a/pkg/kubectl/cmd/config/create_authinfo.go b/pkg/kubectl/cmd/config/create_authinfo.go index e46c2bb3d6f..65422668feb 100644 --- a/pkg/kubectl/cmd/config/create_authinfo.go +++ b/pkg/kubectl/cmd/config/create_authinfo.go @@ -84,6 +84,8 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Co err := options.run() if err != nil { fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "user %q set.\n", options.name) } }, } @@ -197,7 +199,7 @@ func (o *createAuthInfoOptions) complete(cmd *cobra.Command) bool { func (o createAuthInfoOptions) validate() error { if len(o.name) == 0 { - return errors.New("You must specify a non-empty user name") + return errors.New("you must specify a non-empty user name") } methods := []string{} if len(o.token.Value()) > 0 { @@ -207,22 +209,22 @@ func (o createAuthInfoOptions) validate() error { methods = append(methods, fmt.Sprintf("--%v/--%v", clientcmd.FlagUsername, clientcmd.FlagPassword)) } if len(methods) > 1 { - return fmt.Errorf("You cannot specify more than one authentication method at the same time: %v", strings.Join(methods, ", ")) + return fmt.Errorf("you cannot specify more than one authentication method at the same time: %v", strings.Join(methods, ", ")) } if o.embedCertData.Value() { certPath := o.clientCertificate.Value() keyPath := o.clientKey.Value() if certPath == "" && keyPath == "" { - return fmt.Errorf("You must specify a --%s or --%s to embed", clientcmd.FlagCertFile, clientcmd.FlagKeyFile) + return fmt.Errorf("you must specify a --%s or --%s to embed", clientcmd.FlagCertFile, clientcmd.FlagKeyFile) } if certPath != "" { if _, err := ioutil.ReadFile(certPath); err != nil { - return fmt.Errorf("Error reading %s data from %s: %v", clientcmd.FlagCertFile, certPath, err) + return fmt.Errorf("error reading %s data from %s: %v", clientcmd.FlagCertFile, certPath, err) } } if keyPath != "" { if _, err := ioutil.ReadFile(keyPath); err != nil { - return fmt.Errorf("Error reading %s data from %s: %v", clientcmd.FlagKeyFile, keyPath, err) + return fmt.Errorf("error reading %s data from %s: %v", clientcmd.FlagKeyFile, keyPath, err) } } } diff --git a/pkg/kubectl/cmd/config/create_cluster.go b/pkg/kubectl/cmd/config/create_cluster.go index 3fd0432e723..fb1d086c365 100644 --- a/pkg/kubectl/cmd/config/create_cluster.go +++ b/pkg/kubectl/cmd/config/create_cluster.go @@ -69,6 +69,8 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Com err := options.run() if err != nil { fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "cluster %q set.\n", options.name) } }, } @@ -160,18 +162,18 @@ func (o *createClusterOptions) complete(cmd *cobra.Command) bool { func (o createClusterOptions) validate() error { if len(o.name) == 0 { - return errors.New("You must specify a non-empty cluster name") + return errors.New("you must specify a non-empty cluster name") } if o.insecureSkipTLSVerify.Value() && o.certificateAuthority.Value() != "" { - return errors.New("You cannot specify a certificate authority and insecure mode at the same time") + return errors.New("you cannot specify a certificate authority and insecure mode at the same time") } if o.embedCAData.Value() { caPath := o.certificateAuthority.Value() if caPath == "" { - return fmt.Errorf("You must specify a --%s to embed", clientcmd.FlagCAFile) + return fmt.Errorf("you must specify a --%s to embed", clientcmd.FlagCAFile) } if _, err := ioutil.ReadFile(caPath); err != nil { - return fmt.Errorf("Could not read %s data from %s: %v", clientcmd.FlagCAFile, caPath, err) + return fmt.Errorf("could not read %s data from %s: %v", clientcmd.FlagCAFile, caPath, err) } } diff --git a/pkg/kubectl/cmd/config/create_context.go b/pkg/kubectl/cmd/config/create_context.go index 584f255b855..093ce944c42 100644 --- a/pkg/kubectl/cmd/config/create_context.go +++ b/pkg/kubectl/cmd/config/create_context.go @@ -58,7 +58,9 @@ func NewCmdConfigSetContext(out io.Writer, configAccess ConfigAccess) *cobra.Com err := options.run() if err != nil { - fmt.Printf("%v\n", err) + fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "context %q set.\n", options.name) } }, } @@ -124,7 +126,7 @@ func (o *createContextOptions) complete(cmd *cobra.Command) bool { func (o createContextOptions) validate() error { if len(o.name) == 0 { - return errors.New("You must specify a non-empty context name") + return errors.New("you must specify a non-empty context name") } return nil diff --git a/pkg/kubectl/cmd/config/set.go b/pkg/kubectl/cmd/config/set.go index 65f3d029442..c175a23c2f1 100644 --- a/pkg/kubectl/cmd/config/set.go +++ b/pkg/kubectl/cmd/config/set.go @@ -55,7 +55,9 @@ func NewCmdConfigSet(out io.Writer, configAccess ConfigAccess) *cobra.Command { err := options.run() if err != nil { - fmt.Printf("%v\n", err) + fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "property %q set.\n", options.propertyName) } }, } @@ -103,11 +105,11 @@ func (o *setOptions) complete(cmd *cobra.Command) bool { func (o setOptions) validate() error { if len(o.propertyValue) == 0 { - return errors.New("You cannot use set to unset a property") + return errors.New("you cannot use set to unset a property") } if len(o.propertyName) == 0 { - return errors.New("You must specify a property") + return errors.New("you must specify a property") } return nil @@ -124,7 +126,7 @@ func modifyConfig(curr reflect.Value, steps *navigationSteps, propertyValue stri switch actualCurrValue.Kind() { case reflect.Map: if !steps.moreStepsRemaining() && !unset { - return fmt.Errorf("Can't set a map to a value: %v", actualCurrValue) + return fmt.Errorf("can't set a map to a value: %v", actualCurrValue) } mapKey := reflect.ValueOf(currStep.stepValue) @@ -152,14 +154,14 @@ func modifyConfig(curr reflect.Value, steps *navigationSteps, propertyValue stri case reflect.String: if steps.moreStepsRemaining() { - return fmt.Errorf("Can't have more steps after a string. %v", steps) + return fmt.Errorf("can't have more steps after a string. %v", steps) } actualCurrValue.SetString(propertyValue) return nil case reflect.Bool: if steps.moreStepsRemaining() { - return fmt.Errorf("Can't have more steps after a bool. %v", steps) + return fmt.Errorf("can't have more steps after a bool. %v", steps) } boolValue, err := toBool(propertyValue) if err != nil { @@ -198,9 +200,9 @@ func modifyConfig(curr reflect.Value, steps *navigationSteps, propertyValue stri } } - return fmt.Errorf("Unable to locate path %#v under %v", currStep, actualCurrValue) + return fmt.Errorf("unable to locate path %#v under %v", currStep, actualCurrValue) } - panic(fmt.Errorf("Unrecognized type: %v", actualCurrValue)) + panic(fmt.Errorf("unrecognized type: %v", actualCurrValue)) } diff --git a/pkg/kubectl/cmd/config/unset.go b/pkg/kubectl/cmd/config/unset.go index ef418060b62..555309ccbe5 100644 --- a/pkg/kubectl/cmd/config/unset.go +++ b/pkg/kubectl/cmd/config/unset.go @@ -47,7 +47,9 @@ func NewCmdConfigUnset(out io.Writer, configAccess ConfigAccess) *cobra.Command err := options.run() if err != nil { - fmt.Printf("%v\n", err) + fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "property %q unset.\n", options.propertyName) } }, } @@ -95,7 +97,7 @@ func (o *unsetOptions) complete(cmd *cobra.Command) bool { func (o unsetOptions) validate() error { if len(o.propertyName) == 0 { - return errors.New("You must specify a property") + return errors.New("you must specify a property") } return nil diff --git a/pkg/kubectl/cmd/config/use_context.go b/pkg/kubectl/cmd/config/use_context.go index fad34b7ef3f..a6a5c26d557 100644 --- a/pkg/kubectl/cmd/config/use_context.go +++ b/pkg/kubectl/cmd/config/use_context.go @@ -46,6 +46,8 @@ func NewCmdConfigUseContext(out io.Writer, configAccess ConfigAccess) *cobra.Com err := options.run() if err != nil { fmt.Fprintf(out, "%v\n", err) + } else { + fmt.Fprintf(out, "switched to context %q.\n", options.contextName) } }, } @@ -86,7 +88,7 @@ func (o *useContextOptions) complete(cmd *cobra.Command) bool { func (o useContextOptions) validate(config *clientcmdapi.Config) error { if len(o.contextName) == 0 { - return errors.New("You must specify a current-context") + return errors.New("you must specify a current-context") } for name := range config.Contexts { @@ -95,5 +97,5 @@ func (o useContextOptions) validate(config *clientcmdapi.Config) error { } } - return fmt.Errorf("No context exists with the name: %q.", o.contextName) + return fmt.Errorf("no context exists with the name: %q.", o.contextName) } diff --git a/pkg/kubectl/cmd/config/view.go b/pkg/kubectl/cmd/config/view.go index 498be7ef106..8220645eabd 100644 --- a/pkg/kubectl/cmd/config/view.go +++ b/pkg/kubectl/cmd/config/view.go @@ -40,7 +40,7 @@ type ViewOptions struct { } const ( - view_long = `displays Merged kubeconfig settings or a specified kubeconfig file. + view_long = `Displays merged kubeconfig settings or a specified kubeconfig file. You can use --output=template --template=TEMPLATE to extract specific values.` view_example = `# Show Merged kubeconfig settings. @@ -55,7 +55,7 @@ func NewCmdConfigView(out io.Writer, ConfigAccess ConfigAccess) *cobra.Command { cmd := &cobra.Command{ Use: "view", - Short: "displays Merged kubeconfig settings or a specified kubeconfig file.", + Short: "Displays merged kubeconfig settings or a specified kubeconfig file.", Long: view_long, Example: view_example, Run: func(cmd *cobra.Command, args []string) {