captureFallbackText captures the text output from a fallback report
(fallbackReport *applicationsnapshot.Report, fs afero.Fs)
| 1430 | |
| 1431 | // captureFallbackText captures the text output from a fallback report |
| 1432 | func captureFallbackText(fallbackReport *applicationsnapshot.Report, fs afero.Fs) (string, error) { |
| 1433 | formatOpts := format.Options{ |
| 1434 | ShowSuccesses: fallbackReport.ShowSuccesses, |
| 1435 | ShowWarnings: fallbackReport.ShowWarnings, |
| 1436 | ShowPolicyDocsLink: fallbackReport.ShowPolicyDocsLink, |
| 1437 | } |
| 1438 | var fallbackBuf strings.Builder |
| 1439 | fallbackWriter := &stringWriter{&fallbackBuf} |
| 1440 | fallbackParser := format.NewTargetParser( |
| 1441 | applicationsnapshot.Text, |
| 1442 | formatOpts, |
| 1443 | fallbackWriter, |
| 1444 | fs, |
| 1445 | ) |
| 1446 | if err := fallbackReport.WriteAll([]string{outputFormatText}, fallbackParser); err != nil { |
| 1447 | return "", err |
| 1448 | } |
| 1449 | return fallbackBuf.String(), nil |
| 1450 | } |
| 1451 | |
| 1452 | // writeDataToOutput writes data to stdout or a file, adding a newline if needed |
| 1453 | // This is shared between ComponentResultsDisplay.WriteAll and writeVSAReport |
no test coverage detected