EmbarkStudios / cargo-about

📜 Cargo plugin to generate list of all licenses for a crate 🦀
http://embark.rs
Apache License 2.0
545 stars 32 forks source link

Add JSON output #223

Closed lopopolo closed 1 year ago

lopopolo commented 1 year ago

Is your feature request related to a problem? Please describe.

I am using cargo-about to generate a THIRDPARTY.txt listing of all 3p licenses included in Artichoke Ruby to be distributed in build tarballs and docker containers. I orchestrate this with a Ruby gem: https://github.com/artichoke/generate_third_party.

The existing handlebars template is hard to work with (no helpers) and I would ultimately like to work with the raw data parsed from the dependency graph. I work around this by using a handlebars template to output pseudo-YAML which I then transform into actual YAML for deserializing: https://github.com/artichoke/generate_third_party/blob/9b2fe0d175f38d8ef3978cf909c102a67e6c6629/lib/generate_third_party/cargo_about/about.hbs

Describe the solution you'd like

Output all of the data made available to handlebars templates as a JSON-encoded object, written to stdout.

Describe alternatives you've considered

The code I've written to post process the handlebars pseudo-YAML is brittle and subject to breakage around string quoting:

Additional context Add any other context or screenshots about the feature request here.

Jake-Shadle commented 1 year ago

Duplicate #196