Skip to content

Commit

Permalink
🐛 Added CLI output for --probes
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Knight <[email protected]>
  • Loading branch information
eddie-knight committed Oct 24, 2024
1 parent 367426e commit d13c0e1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,14 @@ func rootCmd(o *options.Options) error {
if o.Format == options.FormatDefault {
if len(enabledProbes) > 0 {
printProbeResults(enabledProbes)
} else {
printCheckResults(enabledChecks)
for _, result := range repoResult.Findings {
if result.Remediation != nil {
fmt.Printf("[%s] Remediation required: %s\n", result.Probe, result.Remediation.Text)

Check failure on line 170 in cmd/root.go

View workflow job for this annotation

GitHub Actions / check-linter

use of `fmt.Printf` forbidden because "Do not commit print statements. Output to stdout interferes with users who redirect JSON results to files." (forbidigo)
} else {
fmt.Printf("[%s] Passed: %s\n", result.Probe, result.Message)

Check failure on line 172 in cmd/root.go

View workflow job for this annotation

GitHub Actions / check-linter

use of `fmt.Printf` forbidden because "Do not commit print statements. Output to stdout interferes with users who redirect JSON results to files." (forbidigo)
}
}
return nil
}
}

Expand All @@ -180,6 +186,7 @@ func rootCmd(o *options.Options) error {
return fmt.Errorf("failed to format results: %w", resultsErr)
}

printCheckResults(enabledChecks)
// intentionally placed at end to preserve outputting results, even if a check has a runtime error
for _, result := range repoResult.Checks {
if result.Error != nil {
Expand Down

0 comments on commit d13c0e1

Please sign in to comment.