Skip to content

Commit

Permalink
fixing output as json when podname is given
Browse files Browse the repository at this point in the history
Signed-off-by: Prateeknandle <prateeknandle@gmail.com>
  • Loading branch information
Prateeknandle committed Feb 13, 2023
1 parent e7c472e commit bec4457
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions summary/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ func GetSummary(c *k8s.Client, o Options) ([]string, error) {
if err != nil {
return nil, err
}
DisplaySummaryOutput(sumResp, o.RevDNSLookup, o.Type)
if o.Output == "" {
DisplaySummaryOutput(sumResp, o.RevDNSLookup, o.Type)
}

sumstr := ""
if o.Output == "json" {
arr, _ := json.MarshalIndent(sumResp, "", " ")
sumstr = fmt.Sprintf("%s\n", string(arr))
str = append(str, sumstr)
return str, nil
}

} else {
//Fetch Summary Logs
Expand Down Expand Up @@ -119,7 +129,7 @@ func GetSummary(c *k8s.Client, o Options) ([]string, error) {
}
}
if o.Output == "json" {
return str, err
return str, nil
}
}
return str, nil
Expand Down

0 comments on commit bec4457

Please sign in to comment.