mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
presenter can pick text-dir, text-img, json-text, or json-img for reporting
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
69a0376f99
commit
312c8acfbe
@ -4,8 +4,10 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/anchore/imgbom/imgbom/pkg"
|
"github.com/anchore/imgbom/imgbom/pkg"
|
||||||
"github.com/anchore/imgbom/imgbom/presenter/json"
|
json_dirs "github.com/anchore/imgbom/imgbom/presenter/json/dirs"
|
||||||
"github.com/anchore/imgbom/imgbom/presenter/text"
|
json_imgs "github.com/anchore/imgbom/imgbom/presenter/json/imgs"
|
||||||
|
text_dirs "github.com/anchore/imgbom/imgbom/presenter/text/dirs"
|
||||||
|
text_imgs "github.com/anchore/imgbom/imgbom/presenter/text/imgs"
|
||||||
"github.com/anchore/stereoscope/pkg/image"
|
"github.com/anchore/stereoscope/pkg/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,13 +15,23 @@ type Presenter interface {
|
|||||||
Present(io.Writer) error
|
Present(io.Writer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPresenter(option Option, img *image.Image, catalog *pkg.Catalog) Presenter {
|
func GetImgPresenter(option Option, img *image.Image, catalog *pkg.Catalog) Presenter {
|
||||||
switch option {
|
switch option {
|
||||||
case JSONPresenter:
|
case JSONPresenter:
|
||||||
return json.NewPresenter(img, catalog)
|
return json_imgs.NewPresenter(img, catalog)
|
||||||
case TextPresenter:
|
case TextPresenter:
|
||||||
return text.NewPresenter(img, catalog)
|
return text_imgs.NewPresenter(img, catalog)
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDirPresenter(option Option, path string, catalog *pkg.Catalog) Presenter {
|
||||||
|
switch option {
|
||||||
|
case JSONPresenter:
|
||||||
|
return json_dirs.NewPresenter(catalog, path)
|
||||||
|
case TextPresenter:
|
||||||
|
return text_dirs.NewPresenter(catalog, path)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user