An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/spdx/tools-go

spdx-go is a tool for pretty-printing, converting and validating SPDX files. Formats supported by this tool are RDF (all RDF syntaxes supported by the raptor library) and Tag. For a full list of formats, see `-help`. Basic usage =========== The basic usage of this tool is the following: One action flag must be specified. Those are: For a list of all flags and usage, see `-help`. Input and output ---------------- The input, if no input file specified, is read from standard input. and input format (using flag `-i <format>`) must be specified in this case. Output is, by default, on standard output. The flag `-o <file>` can be used to specify an output file. Flag `-w` can be used to overwrite the input file, useful for pretty-printing: The flag -w creates a temporary file and tries to change the innode of the input file to the temporary file and then delete the temporary file. If that fails, it hard copies the temporary file over the input file. SPDX File formats ----------------- With every command in this tool, the flag -f <format> makes the parser to use <format> as the input format. For a list of all valid formats, see `-help`. The format "rdf" is a special format. For output, it means "xmlrdf-abbrev"; for input, it means attempt to guess the RDF syntax in the input file (uses raptor's "guess" parser). Pretty-print (format) SPDX file =============================== Use the `-p` flag to pretty-print a SPDX document. Pretty-printing does not parse the input document into a `spdx.Document` struct but only tokenizes the input format and pretty-prints the tokens. This means that invalid SPDX documents may be printed. A known limitation is the fact that comments in any RDF syntax are dismissed. The same limitation does not apply to the Tag format, where comments are printed and formatted. Example: Convert between formats ======================= Use the `-c <format>` flag to convert to and from supported SPDX formats. Example: Validate SPDX file ================== SPDX files in any formats are parsed to `spdx.Document` and thus validated to the SPDX Specification. Use the `-v` flag to validate documents. Example: HTML output validation ---------------------- To better visualise the validation errors and warnings, HTML output is supported by this tool. The `-html` flag used in conjunction with the `-v` flag creates a HTML file that contains the input file and all the validation errors represented nicely in the page. If no output file is specified, a temporary file is created and opened in a (default) browser window. If there is an output file specified (`-o <file>`), the HTML is written to that file instead and no browser window opened. Example: Updating licence list --------------------- The spdx-go tool assumes that a file named `licence-list.txt` exists. However, this file is not included in the repository but it is quite simple to generate: The file only contains one licence ID per line. The script generates the most up-to-date file from the SPDX Licence List git repository. This git repository has a submodule in `spdx/licence-list` which points to the official SPDX Licence List repository. For how it works, see the documentation for the `spdx` package. spdx-tools-go ============= This tool also serves as an example usage of the SPDX Go Parsing Library, which can be found at:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/spdx/tools-go
License: Apache-2.0
Latest release: over 3 years ago
First release: over 3 years ago
Namespace: github.com/spdx
Stars: 6 on GitHub
Forks: 10 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago

    Loading...
    Readme
    Loading...