mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
36 lines
926 B
Go
36 lines
926 B
Go
package packages
|
|
|
|
import "strings"
|
|
|
|
const (
|
|
UnknownPresenterOption PresenterOption = "UnknownPresenterOption"
|
|
JSONPresenterOption PresenterOption = "json"
|
|
TextPresenterOption PresenterOption = "text"
|
|
TablePresenterOption PresenterOption = "table"
|
|
CycloneDxPresenterOption PresenterOption = "cyclonedx"
|
|
)
|
|
|
|
var AllPresenters = []PresenterOption{
|
|
JSONPresenterOption,
|
|
TextPresenterOption,
|
|
TablePresenterOption,
|
|
CycloneDxPresenterOption,
|
|
}
|
|
|
|
type PresenterOption string
|
|
|
|
func ParsePresenterOption(userStr string) PresenterOption {
|
|
switch strings.ToLower(userStr) {
|
|
case string(JSONPresenterOption):
|
|
return JSONPresenterOption
|
|
case string(TextPresenterOption):
|
|
return TextPresenterOption
|
|
case string(TablePresenterOption):
|
|
return TablePresenterOption
|
|
case string(CycloneDxPresenterOption), "cyclone", "cyclone-dx":
|
|
return CycloneDxPresenterOption
|
|
default:
|
|
return UnknownPresenterOption
|
|
}
|
|
}
|