Alex Goodman ff4ed40d50
migrate syft/presenter to internal/presenter
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
2021-03-22 10:52:33 -04:00

26 lines
834 B
Go

/*
Defines a Presenter interface for displaying catalog results to an io.Writer as well as a helper utility to obtain
a specific Presenter implementation given user configuration.
*/
package packages
import (
"github.com/anchore/syft/internal/presenter"
)
// Presenter returns a presenter for images or directories
func Presenter(option PresenterOption, config PresenterConfig) presenter.Presenter {
switch option {
case JSONPresenterOption:
return NewJSONPresenter(config.Catalog, config.SourceMetadata, config.Distro, config.Scope)
case TextPresenterOption:
return NewTextPresenter(config.Catalog, config.SourceMetadata)
case TablePresenterOption:
return NewTablePresenter(config.Catalog)
case CycloneDxPresenterOption:
return NewCycloneDxPresenter(config.Catalog, config.SourceMetadata)
default:
return nil
}
}