Skip to content

Commit

Permalink
Add a new flag terse to show only the results and summary (#986)
Browse files Browse the repository at this point in the history
The new flag '-terse' will only show the results and summary ignoring any logs occured during a scan.

Signed-off-by: Cosmin Cojocar <[email protected]>
  • Loading branch information
ccojocar authored Jul 18, 2023
1 parent 36f6933 commit fc570b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/gosec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ var (
// output suppression information for auditing purposes
flagTrackSuppressions = flag.Bool("track-suppressions", false, "Output suppression information, including its kind and justification")

// flagTerse shows only the summary of scan discarding all the logs
flagTerse = flag.Bool("terse", false, "Shows only the results and summary")

// exclude the folders from scan
flagDirsExclude arrayFlags

Expand Down Expand Up @@ -354,7 +357,7 @@ func main() {
}
}

if *flagQuiet {
if *flagQuiet || *flagTerse {
logger = log.New(io.Discard, "", 0)
} else {
logger = log.New(logWriter, "[gosec] ", log.LstdFlags)
Expand Down

0 comments on commit fc570b6

Please sign in to comment.