From cd3e7ecba34704a472c2869498310c97125cde41 Mon Sep 17 00:00:00 2001 From: David Roe Date: Wed, 2 Aug 2023 11:39:38 +0100 Subject: [PATCH] fix: honor quiet flag in diff logic (#1168) --- pkg/commands/artifact/run.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/commands/artifact/run.go b/pkg/commands/artifact/run.go index 6cf5c8af3..6154a7c0f 100644 --- a/pkg/commands/artifact/run.go +++ b/pkg/commands/artifact/run.go @@ -188,10 +188,10 @@ func (r *runner) Scan(ctx context.Context, opts flag.Options) (*basebranchfindin var baseBranchFindings *basebranchfindings.Findings if err := repository.WithBaseBranch(func() error { - output.StdErrLog(fmt.Sprintf( - "\nScanning base branch %s", - opts.DiffBaseBranch, - )) + if !opts.Quiet { + output.StdErrLog(fmt.Sprintf("\nScanning base branch %s", opts.DiffBaseBranch)) + } + if err := orchestrator.Scan(r.reportPath+".base", fileList.BaseFiles); err != nil { return err } @@ -204,7 +204,10 @@ func (r *runner) Scan(ctx context.Context, opts flag.Options) (*basebranchfindin baseBranchFindings = buildBaseBranchFindings(fileList, detections) - output.StdErrLog("\nScanning current branch") + if !opts.Quiet { + output.StdErrLog("\nScanning current branch") + } + return nil }); err != nil { return nil, err