call 'strings.ToLower(output)' only once

pull/9390/head
Predrag Rogic 2020-11-06 22:28:26 +00:00
parent d0c0d8b54c
commit 0c3843bfc6
No known key found for this signature in database
GPG Key ID: F1FF5748C4855229
1 changed files with 4 additions and 3 deletions

View File

@ -197,11 +197,12 @@ var statusCmd = &cobra.Command{
Exit status contains the status of minikube's VM, cluster and Kubernetes encoded on it's bits in this order from right to left.
Eg: 7 meaning: 1 (for minikube NOK) + 2 (for cluster NOK) + 4 (for Kubernetes NOK)`,
Run: func(cmd *cobra.Command, args []string) {
if strings.ToLower(output) != "text" && statusFormat != defaultStatusFormat {
output = strings.ToLower(output)
if output != "text" && statusFormat != defaultStatusFormat {
exit.Message(reason.Usage, "Cannot use both --output and --format options")
}
out.SetJSON(strings.ToLower(output) == "json")
out.SetJSON(output == "json")
cname := ClusterFlagValue()
api, cc := mustload.Partial(cname)
@ -236,7 +237,7 @@ var statusCmd = &cobra.Command{
}
}
switch strings.ToLower(output) {
switch output {
case "text":
for _, st := range statuses {
if err := statusText(st, os.Stdout); err != nil {