syft/syft/source/scope.go
Alex Goodman 6f7a4fd3e4
move source metadata upstream and fix tests
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
2020-11-17 12:37:12 -05:00

31 lines
546 B
Go

package source
import "strings"
type Scope string
const (
UnknownScope Scope = "UnknownScope"
SquashedScope Scope = "Squashed"
AllLayersScope Scope = "AllLayers"
)
var AllScopes = []Scope{
SquashedScope,
AllLayersScope,
}
func ParseScope(userStr string) Scope {
switch strings.ToLower(userStr) {
case strings.ToLower(SquashedScope.String()):
return SquashedScope
case "all-layers", strings.ToLower(AllLayersScope.String()):
return AllLayersScope
}
return UnknownScope
}
func (o Scope) String() string {
return string(o)
}