(data interface{})
| 95 | } |
| 96 | |
| 97 | func printJSON(data interface{}) error { |
| 98 | var output []byte |
| 99 | var err error |
| 100 | |
| 101 | if prettyPrint { |
| 102 | output, err = json.MarshalIndent(data, "", " ") |
| 103 | } else { |
| 104 | output, err = json.Marshal(data) |
| 105 | } |
| 106 | |
| 107 | if err != nil { |
| 108 | return fmt.Errorf("failed to marshal JSON: %w", err) |
| 109 | } |
| 110 | |
| 111 | if _, err := fmt.Fprintln(writer, string(output)); err != nil { |
| 112 | return fmt.Errorf("failed to write JSON output: %w", err) |
| 113 | } |
| 114 | return nil |
| 115 | } |
| 116 | |
| 117 | func printTable(data interface{}) error { |
| 118 | w := tabwriter.NewWriter(writer, 0, 0, 2, ' ', 0) |
no outgoing calls
no test coverage detected