github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/cmd/syft/cli/options/scope.go (about) 1 package options 2 3 import ( 4 "fmt" 5 6 "github.com/anchore/clio" 7 "github.com/anchore/syft/syft/source" 8 ) 9 10 type scope struct { 11 Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"` 12 Scope string `yaml:"scope" json:"scope" mapstructure:"scope"` 13 } 14 15 var _ clio.PostLoader = (*scope)(nil) 16 17 func (opt *scope) PostLoad() error { 18 s := opt.GetScope() 19 if s == source.UnknownScope { 20 return fmt.Errorf("bad scope value %v", opt.Scope) 21 } 22 return nil 23 } 24 25 func (opt scope) GetScope() source.Scope { 26 return source.ParseScope(opt.Scope) 27 }