File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use cargo_cyclonedx::{
88 platform:: host_platform,
99} ;
1010use clap:: { ArgAction , ArgGroup , Parser } ;
11+ use cyclonedx_bom:: models:: bom:: SpecVersion ;
1112use std:: collections:: HashSet ;
1213use std:: iter:: FromIterator ;
1314use std:: path;
@@ -95,6 +96,10 @@ Defaults to the host target, as printed by 'rustc -vV'"
9596 /// Add license names which will not be warned about when parsing them as a SPDX expression fails
9697 #[ clap( long = "license-accept-named" , action=ArgAction :: Append ) ]
9798 pub license_accept_named : Vec < String > ,
99+
100+ /// The CycloneDX specification version to output: `1.3` or `1.4`
101+ #[ clap( long = "spec-version" ) ]
102+ pub spec_version : Option < SpecVersion > ,
98103}
99104
100105impl Args {
@@ -164,6 +169,7 @@ impl Args {
164169 } ) ;
165170
166171 let describe = self . describe . clone ( ) ;
172+ let spec_version = self . spec_version . clone ( ) ;
167173
168174 Ok ( SbomConfig {
169175 format : self . format ,
@@ -173,6 +179,7 @@ impl Args {
173179 target,
174180 license_parser,
175181 describe,
182+ spec_version,
176183 } )
177184 }
178185}
Original file line number Diff line number Diff line change 1+ use cyclonedx_bom:: models:: bom:: SpecVersion ;
12use serde:: Deserialize ;
23use std:: collections:: HashSet ;
34use std:: str:: FromStr ;
@@ -31,6 +32,7 @@ pub struct SbomConfig {
3132 pub target : Option < Target > ,
3233 pub license_parser : Option < LicenseParserOptions > ,
3334 pub describe : Option < Describe > ,
35+ pub spec_version : Option < SpecVersion > ,
3436}
3537
3638impl SbomConfig {
@@ -54,6 +56,10 @@ impl SbomConfig {
5456 . map ( |other| self . license_parser . clone ( ) . unwrap_or_default ( ) . merge ( other) )
5557 . or_else ( || self . license_parser . clone ( ) ) ,
5658 describe : other. describe . clone ( ) . or_else ( || self . describe . clone ( ) ) ,
59+ spec_version : other
60+ . spec_version
61+ . clone ( )
62+ . or_else ( || self . spec_version . clone ( ) ) ,
5763 }
5864 }
5965
You can’t perform that action at this time.
0 commit comments