mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 06:26:30 +01:00
* initial readme + logging and output fixes to support descriptions * minor tweaks to README descriptions * simplify phrasing Co-authored-by: Alfredo Deza <adeza@anchore.com> * add comment for example gif Co-authored-by: Alfredo Deza <adeza@anchore.com> * spelling fix Co-authored-by: Alfredo Deza <adeza@anchore.com> * update phrasing Co-authored-by: Alfredo Deza <adeza@anchore.com> * simplify TODO note Co-authored-by: Alfredo Deza <adeza@anchore.com> * grammar fix Co-authored-by: Alfredo Deza <adeza@anchore.com> * phrase fix Co-authored-by: Alfredo Deza <adeza@anchore.com> * rm readme bash block indicators * clarify config examples are default values * rm value Co-authored-by: Alfredo Deza <adeza@anchore.com> Co-authored-by: Alfredo Deza <adeza@anchore.com>
41 lines
636 B
Go
41 lines
636 B
Go
package scope
|
|
|
|
import "strings"
|
|
|
|
const (
|
|
UnknownScope Option = iota
|
|
SquashedScope
|
|
AllLayersScope
|
|
)
|
|
|
|
type Option int
|
|
|
|
var optionStr = []string{
|
|
"UnknownScope",
|
|
"Squashed",
|
|
"AllLayers",
|
|
}
|
|
|
|
var Options = []Option{
|
|
SquashedScope,
|
|
AllLayersScope,
|
|
}
|
|
|
|
func ParseOption(userStr string) Option {
|
|
switch strings.ToLower(userStr) {
|
|
case strings.ToLower(SquashedScope.String()):
|
|
return SquashedScope
|
|
case "all-layers", strings.ToLower(AllLayersScope.String()):
|
|
return AllLayersScope
|
|
}
|
|
return UnknownScope
|
|
}
|
|
|
|
func (o Option) String() string {
|
|
if int(o) >= len(optionStr) || o < 0 {
|
|
return optionStr[0]
|
|
}
|
|
|
|
return optionStr[o]
|
|
}
|