Skip to content

Commit

Permalink
Merge pull request #299 from viveksahu26/cli/score_command_fix
Browse files Browse the repository at this point in the history
add examples for score and compliance command
  • Loading branch information
riteshnoronha authored Aug 11, 2024
2 parents 4c00484 + a2f2510 commit a6774a6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
14 changes: 14 additions & 0 deletions cmd/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ var complianceCmd = &cobra.Command{
Long: `Check if your SBOM complies with various SBOM standards like NTIA minimum elements, BSI TR-03183-2, OpenChain Telco.
Generate a compliance report for an SBOM file.
`,
Example: ` sbomqs compliance --bsi|--oct [--basic|--json] <SBOM file>
# Check a BSI TR-03183-2 v1.1 compliance against a SBOM in a table output
sbomqs compliance --bsi samples/sbomqs-spdx-syft.json
# Check a BSI TR-03183-2 v1.1 compliance against a SBOM in a JSON output
sbomqs compliance --bsi --json samples/sbomqs-spdx-syft.json
# Check a OpenChain Telco compliance against a SBOM in a table output
sbomqs compliance --oct samples/sbomqs-spdx-syft.json
# Check a OpenChain Telco compliance against a SBOM in a JSON output
sbomqs compliance --oct --json samples/sbomqs-spdx-syft.json
`,
Args: func(cmd *cobra.Command, args []string) error {
if err := cobra.ExactArgs(1)(cmd, args); err != nil {
return fmt.Errorf("compliance requires a single argument, the path to an SBOM file")
Expand Down
22 changes: 20 additions & 2 deletions cmd/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ var scoreCmd = &cobra.Command{
Use: "score",
Short: "comprehensive quality score for your sbom",
SilenceUsage: true,
Example: ` sbomqs score [--category <category>] [--feature <feature>] [--basic|--json] <SBOM file>
# Get a score against a SBOM in a table output
sbomqs score samples/sbomqs-spdx-syft.json
# Get a score against a SBOM in a basic output
sbomqs score --basic samples/sbomqs-spdx-syft.json
# Get a score against a SBOM in a JSON output
sbomqs score --json samples/sbomqs-spdx-syft.json
# Get a score for a 'NTIA-minimum-elements' category against a SBOM in a table output
sbomqs score --category NTIA-minimum-elements samples/sbomqs-spdx-syft.json
# Get a score for a 'NTIA-minimum-elements' category and 'sbom_authors' feature against a SBOM in a table output
sbomqs score --category NTIA-minimum-elements --feature sbom_authors samples/sbomqs-spdx-syft.json
`,

Args: func(cmd *cobra.Command, args []string) error {
if len(args) <= 0 {
if len(inFile) <= 0 && len(inDirPath) <= 0 {
Expand Down Expand Up @@ -187,8 +205,8 @@ func init() {
scoreCmd.Flags().StringP("configpath", "", "", "scoring based on config path")

// Filter Control
scoreCmd.Flags().StringP("category", "c", "", "filter by category")
scoreCmd.Flags().StringP("feature", "f", "", "filter by feature")
scoreCmd.Flags().StringP("category", "c", "", "filter by category (e.g. 'NTIA-minimum-elements', 'Quality', 'Semantic', 'Sharing', 'Structural')")
scoreCmd.Flags().StringP("feature", "f", "", "filter by feature (e.g. 'sbom_authors', 'comp_with_name', 'sbom_creation_timestamp') ")

// Spec Control
scoreCmd.Flags().BoolP("spdx", "", false, "limit scoring to spdx sboms")
Expand Down

0 comments on commit a6774a6

Please sign in to comment.