lib: return a protocol-based scope (dir or img)

Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
Alfredo Deza
2020-07-02 15:12:48 -04:00
parent 678a2c1dcb
commit faf21a67a6
+9 -2
View File
@@ -16,12 +16,19 @@ func IdentifyDistro(img *image.Image) *distro.Distro {
return distro.Identify(img)
}
func CatalogImage(img *image.Image, o scope.Option) (*pkg.Catalog, error) {
s, err := scope.NewScope(img, o)
func CatalogDir(d string, o scope.Option) (*pkg.Catalog, error) {
s, err := scope.NewDirScope(d, o)
if err != nil {
return nil, err
}
return cataloger.Catalog(s)
}
func CatalogImg(img *image.Image, o scope.Option) (*pkg.Catalog, error) {
s, err := scope.NewImageScope(img, o)
if err != nil {
return nil, err
}
return cataloger.Catalog(s)
}