writeVSAReport writes a combined VSAReport to all specified output formats display is used for text format to avoid reconstructing ComponentResultsDisplay
(report VSAReport, display ComponentResultsDisplay, outputFormats []string, fs afero.Fs, cmd *cobra.Command)
| 1332 | // writeVSAReport writes a combined VSAReport to all specified output formats |
| 1333 | // display is used for text format to avoid reconstructing ComponentResultsDisplay |
| 1334 | func writeVSAReport(report VSAReport, display ComponentResultsDisplay, outputFormats []string, fs afero.Fs, cmd *cobra.Command) error { |
| 1335 | if len(outputFormats) == 0 { |
| 1336 | outputFormats = []string{outputFormatText} |
| 1337 | } |
| 1338 | |
| 1339 | for _, outputSpec := range outputFormats { |
| 1340 | formatName, file := parseOutputSpec(outputSpec) |
| 1341 | |
| 1342 | data, err := convertVSAReportToFormat(report, display, formatName, fs) |
| 1343 | if err != nil { |
| 1344 | return err |
| 1345 | } |
| 1346 | |
| 1347 | if err := writeDataToOutput(data, formatName, file, fs, cmd); err != nil { |
| 1348 | return err |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | return nil |
| 1353 | } |
| 1354 | |
| 1355 | // convertVSAReportToFormat converts a VSAReport to the specified format |
| 1356 | func convertVSAReportToFormat(report VSAReport, display ComponentResultsDisplay, formatName string, fs afero.Fs) ([]byte, error) { |
no test coverage detected