mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
28 lines
543 B
Go
28 lines
543 B
Go
package options
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/anchore/clio"
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
type scope struct {
|
|
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
|
|
Scope string `yaml:"scope" json:"scope" mapstructure:"scope"`
|
|
}
|
|
|
|
var _ clio.PostLoader = (*scope)(nil)
|
|
|
|
func (opt *scope) PostLoad() error {
|
|
s := opt.GetScope()
|
|
if s == source.UnknownScope {
|
|
return fmt.Errorf("bad scope value %v", opt.Scope)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (opt scope) GetScope() source.Scope {
|
|
return source.ParseScope(opt.Scope)
|
|
}
|