github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/cmd/syft/internal/options/format_spdx_json.go (about)

     1  package options
     2  
     3  import (
     4  	"github.com/anchore/syft/syft/format/spdxjson"
     5  )
     6  
     7  type FormatSPDXJSON struct {
     8  	Pretty *bool `yaml:"pretty" json:"pretty" mapstructure:"pretty"`
     9  }
    10  
    11  func DefaultFormatSPDXJSON() FormatSPDXJSON {
    12  	return FormatSPDXJSON{}
    13  }
    14  
    15  func (o FormatSPDXJSON) config(v string) spdxjson.EncoderConfig {
    16  	var pretty bool
    17  	if o.Pretty != nil {
    18  		pretty = *o.Pretty
    19  	}
    20  	return spdxjson.EncoderConfig{
    21  		Version: v,
    22  		Pretty:  pretty,
    23  	}
    24  }