Improve message from kubectl config

1.use Fprintf instead of Printf
2.output simple success messages
3.lowercase all error messages
This commit is contained in:
hurf
2015-09-23 16:08:42 +08:00
parent 45a8b5f98a
commit c4dc056105
11 changed files with 45 additions and 33 deletions

View File

@@ -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)
}