toText converts ComponentResultsDisplay to text format using existing String() methods This reuses the existing formatting logic and avoids code duplication
()
| 1282 | // toText converts ComponentResultsDisplay to text format using existing String() methods |
| 1283 | // This reuses the existing formatting logic and avoids code duplication |
| 1284 | func (d ComponentResultsDisplay) toText() []byte { |
| 1285 | var b strings.Builder |
| 1286 | b.WriteString(d.Header.String()) |
| 1287 | b.WriteString("\n") |
| 1288 | b.WriteString(d.Result.String()) |
| 1289 | b.WriteString("\n") |
| 1290 | b.WriteString(d.VSASummary.String()) |
| 1291 | b.WriteString("\n") |
| 1292 | if d.PolicyDiff != nil { |
| 1293 | b.WriteString(d.PolicyDiff.String()) |
| 1294 | b.WriteString("\n") |
| 1295 | } |
| 1296 | return []byte(b.String()) |
| 1297 | } |
| 1298 | |
| 1299 | // WriteAll writes ComponentResultsDisplay to all specified output formats |
| 1300 | func (d ComponentResultsDisplay) WriteAll(outputFormats []string, fs afero.Fs, cmd *cobra.Command) error { |
no test coverage detected