sbom-convert

command module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

SBOM Convert CLI

This reporistory contains a command line interface (cli), based on the protobom library, that converts SBOMs across formats (SPDX and CycloneDX).

Usage

Commands

sbom-convert convert [input] [flags] sbom-convert [input] [flags]

Input

The convert command takes in a single - as of now - json file in either SPDX or CycloneDX format, and outputs an SBOM in a different format.

  • The file must be json
  • The file must be a valid CycloneDX / SPDX document
Flags
  • -e, --encoding: (string, optional) The output encoding [spdx: [text, json] cyclonedx: [json] (default "json")
  • -f, --format: (string, Required) The output format [spdx, spdx-2.3, cyclonedx, cyclonedx-1.4]
  • -h, --help:` help for convert
  • -o, --output: (string, optional) Path to write the converted SBOM. Default: stdout. A user can provide just a string for the filename (e.g "mybom"), which will create a file mybom.json. Users can also specify an SPDX tag-value format, e.g. myBOM.spdx.

Global Flags:

  • -c, --config: (string, optional) Path to config file
  • -v, --verbose: log verbosity level (-v=info, -vv=debug, -vvv=trace)
Examples

sbom-convert convert sbom.cdx.json output to stdout in inverse format

sbom-convert convert sbom.spdx.json -o sbom.cdx.json output to a file

sbom-convert convert sbom.cdx.json -f spdx-2.3 select a specific target format

sbom-convert convert sbom.cdx.json -f spdx -e text select specific encoding

Architecture

The architecture of the CLI looks more or less like this:

flowchart TB
    a2-->b2
    b2-->c2
    b2-->c3
    subgraph "sbom-convert"
      subgraph "End User CLI"
        a2("internal/cmd")
      end
      subgraph "translate API"
        b2("translate.Translator")
       end
    end
    subgraph "protobom API"
    c2("writer.Writer")-->c4("writer.Serializer")
    c3("reader.Reader")-->c5("reader.Unserializer")
    end

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
cli
pkg
convert/mocks
Code generated by MockGen.
Code generated by MockGen.
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL