mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
lib: use scope instead of requiring images
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
d22c1d0838
commit
145bb95a2d
@ -12,23 +12,19 @@ import (
|
|||||||
"github.com/wagoodman/go-partybus"
|
"github.com/wagoodman/go-partybus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IdentifyDistro(img *image.Image) *distro.Distro {
|
func IdentifyDistro(s scope.Scope) *distro.Distro {
|
||||||
return distro.Identify(img)
|
return distro.Identify(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CatalogDir(d string, o scope.Option) (*pkg.Catalog, error) {
|
func GetScopeFromDir(d string, o scope.Option) (scope.Scope, error) {
|
||||||
s, err := scope.NewDirScope(d, o)
|
return scope.NewScopeFromDir(d, o)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return cataloger.Catalog(s)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func CatalogImg(img *image.Image, o scope.Option) (*pkg.Catalog, error) {
|
func GetScopeFromImage(img *image.Image, o scope.Option) (scope.Scope, error) {
|
||||||
s, err := scope.NewImageScope(img, o)
|
return scope.NewScopeFromImage(img, o)
|
||||||
if err != nil {
|
}
|
||||||
return nil, err
|
|
||||||
}
|
func Catalog(s scope.Scope) (*pkg.Catalog, error) {
|
||||||
return cataloger.Catalog(s)
|
return cataloger.Catalog(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user