mirror of
https://github.com/anchore/syft.git
synced 2025-11-19 01:13:18 +01:00
* internalize majority of cmd package and migrate integration tests Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add internal api encoder Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * create internal representation of all formats Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * export capability to get default encoders Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * restore test fixtures Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
28 lines
526 B
Go
28 lines
526 B
Go
package options
|
|
|
|
import (
|
|
"github.com/anchore/syft/syft/format/syftjson"
|
|
)
|
|
|
|
type FormatSyftJSON struct {
|
|
Legacy bool `yaml:"legacy" json:"legacy" mapstructure:"legacy"`
|
|
Pretty *bool `yaml:"pretty" json:"pretty" mapstructure:"pretty"`
|
|
}
|
|
|
|
func DefaultFormatJSON() FormatSyftJSON {
|
|
return FormatSyftJSON{
|
|
Legacy: false,
|
|
}
|
|
}
|
|
|
|
func (o FormatSyftJSON) config() syftjson.EncoderConfig {
|
|
var pretty bool
|
|
if o.Pretty != nil {
|
|
pretty = *o.Pretty
|
|
}
|
|
return syftjson.EncoderConfig{
|
|
Legacy: o.Legacy,
|
|
Pretty: pretty,
|
|
}
|
|
}
|