From afee1f4e894ac1e1c5d8790d2d5c28d916ac555a Mon Sep 17 00:00:00 2001 From: Teppei Fukuda Date: Thu, 27 Jun 2024 10:13:32 +0400 Subject: [PATCH] fix(cli): show info message only when --scanners is available (#7032) Signed-off-by: knqyf263 --- pkg/flag/options.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/flag/options.go b/pkg/flag/options.go index 8f15480ccfec..70470dc05e2f 100644 --- a/pkg/flag/options.go +++ b/pkg/flag/options.go @@ -364,8 +364,10 @@ type Options struct { } // Align takes consistency of options -func (o *Options) Align() error { - o.enableSBOM() +func (o *Options) Align(f *Flags) error { + if f.ScanFlagGroup != nil && f.ScanFlagGroup.Scanners != nil { + o.enableSBOM() + } if o.Compliance.Spec.ID != "" { if viper.IsSet(ScannersFlag.ConfigName) { @@ -749,7 +751,7 @@ func (f *Flags) ToOptions(args []string) (Options, error) { } } - if err := opts.Align(); err != nil { + if err := opts.Align(f); err != nil { return Options{}, xerrors.Errorf("align options error: %w", err) }