From fc570b6f1a537270923f9b516da3d360f1732758 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 18 Jul 2023 16:21:22 +0200 Subject: [PATCH] Add a new flag terse to show only the results and summary (#986) The new flag '-terse' will only show the results and summary ignoring any logs occured during a scan. Signed-off-by: Cosmin Cojocar --- cmd/gosec/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/gosec/main.go b/cmd/gosec/main.go index e09b008..e108ba9 100644 --- a/cmd/gosec/main.go +++ b/cmd/gosec/main.go @@ -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 @@ -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)