Skip to content

Commit e9fc3e3

Browse files
authored
fix(cli): show info message only when --scanners is available (#7032)
Signed-off-by: knqyf263 <[email protected]>
1 parent 0ccdbfb commit e9fc3e3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/flag/options.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ type Options struct {
364364
}
365365

366366
// Align takes consistency of options
367-
func (o *Options) Align() error {
368-
o.enableSBOM()
367+
func (o *Options) Align(f *Flags) error {
368+
if f.ScanFlagGroup != nil && f.ScanFlagGroup.Scanners != nil {
369+
o.enableSBOM()
370+
}
369371

370372
if o.Compliance.Spec.ID != "" {
371373
if viper.IsSet(ScannersFlag.ConfigName) {
@@ -749,7 +751,7 @@ func (f *Flags) ToOptions(args []string) (Options, error) {
749751
}
750752
}
751753

752-
if err := opts.Align(); err != nil {
754+
if err := opts.Align(f); err != nil {
753755
return Options{}, xerrors.Errorf("align options error: %w", err)
754756
}
755757

0 commit comments

Comments
 (0)