diff --git a/pkg/cli/discover.go b/pkg/cli/discover.go index 883484b..ad90dea 100644 --- a/pkg/cli/discover.go +++ b/pkg/cli/discover.go @@ -31,6 +31,8 @@ func DiscoverCmd() *cobra.Command { log.Error().Err(err).Msg("discover failed") os.Exit(1) } + + log.Info().Str("output", output).Msg("successfully discovered installed packages") }, } diff --git a/pkg/distro/distro.go b/pkg/distro/distro.go index 6b04bbe..3ca7cc8 100644 --- a/pkg/distro/distro.go +++ b/pkg/distro/distro.go @@ -18,25 +18,23 @@ type Distro interface { func InstalledPackages(doc *spdx.Document) error { deberr := deb.InstalledPackages(doc) - if deberr != nil { - log.Error().Err(deberr).Msg("deb: unable to get installed packages") + if deberr == nil { + return nil } rpmerr := rpm.InstalledPackages(doc) - if rpmerr != nil { - log.Error().Err(rpmerr).Msg("rpm: unable to get installed packages") + if rpmerr == nil { + return nil } apkerr := apk.InstalledPackages(doc) - if apkerr != nil { - log.Error().Err(apkerr).Msg("apk: unable to get installed packages") + if apkerr == nil { + return nil } - if deberr != nil && rpmerr != nil && apkerr != nil { - return errors.ErrNotFound - } + log.Error().Err(apkerr).Msg("unable to get installed packages") - return nil + return errors.ErrNotFound } func ParsePackage(input, author, organization, license, output string) error {