mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
28 lines
735 B
Go
28 lines
735 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
|
|
"github.com/anchore/syft/internal/capabilities"
|
|
"github.com/anchore/syft/internal/task"
|
|
)
|
|
|
|
// allPackageCatalogerInfo gets all package cataloger info (names and selectors) from task factories
|
|
func allPackageCatalogerInfo() ([]capabilities.CatalogerInfo, error) {
|
|
pkgTaskFactories := task.DefaultPackageTaskFactories()
|
|
allPkgTasks, err := pkgTaskFactories.Tasks(task.DefaultCatalogingFactoryConfig())
|
|
if err != nil {
|
|
return nil, fmt.Errorf("unable to create pkg cataloger tasks: %w", err)
|
|
}
|
|
|
|
infos := capabilities.ExtractCatalogerInfo(allPkgTasks)
|
|
|
|
// sort by name for consistency
|
|
sort.Slice(infos, func(i, j int) bool {
|
|
return infos[i].Name < infos[j].Name
|
|
})
|
|
|
|
return infos, nil
|
|
}
|