From cf7b7ffef58799ab19c4f040264a3e63012ccf00 Mon Sep 17 00:00:00 2001 From: knqyf263 Date: Thu, 27 Jun 2024 07:31:56 +0400 Subject: [PATCH] fix(cli): show info message only when --scanners is available 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 3777bed507fb..1619f8474b55 100644 --- a/pkg/flag/options.go +++ b/pkg/flag/options.go @@ -353,8 +353,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) { @@ -738,7 +740,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) }