mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
rename scope to source
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package source
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
UnknownScope Scope = iota
|
||||
SquashedScope
|
||||
AllLayersScope
|
||||
)
|
||||
|
||||
type Scope int
|
||||
|
||||
var optionStr = []string{
|
||||
"UnknownScope",
|
||||
"Squashed",
|
||||
"AllLayers",
|
||||
}
|
||||
|
||||
var Options = []Scope{
|
||||
SquashedScope,
|
||||
AllLayersScope,
|
||||
}
|
||||
|
||||
func ParseOption(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 {
|
||||
if int(o) >= len(optionStr) || o < 0 {
|
||||
return optionStr[0]
|
||||
}
|
||||
|
||||
return optionStr[o]
|
||||
}
|
||||
Reference in New Issue
Block a user