rename scope to source

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2020-11-17 12:37:11 -05:00
parent 495fb0a45f
commit 9668341a14
55 changed files with 340 additions and 334 deletions
+40
View File
@@ -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]
}