Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user-defined output formats #152

Closed
luhring opened this issue Aug 18, 2020 · 3 comments · Fixed by #1051
Closed

Allow user-defined output formats #152

luhring opened this issue Aug 18, 2020 · 3 comments · Fixed by #1051
Assignees
Labels
enhancement New feature or request I/O Describes bug or enhancement around application input or output

Comments

@luhring
Copy link
Contributor

luhring commented Aug 18, 2020

Some CLI tools, including docker, provide a command line option for the user to specify exactly in what form they would like to receive the tool's output.

Screen Shot 2020-08-18 at 3 30 33 PM

This is incredibly useful, as it allows users to hand pick which fields they are interested in, and it allows users to consume data using formats that the developers haven't yet considered or implemented.

For example, users could get CSV data out of the tool without us having to create an explicit output option for CSV:

$ syft myimage --format '{{.Name}},{{.Version}},{{.Type}}`
adduser,3.118ubuntu2,deb
alsa-topology-conf,1.2.2-1,deb
alsa-ucm-conf,1.2.2-1ubuntu0.1,deb
apt,2.0.2ubuntu0.1,deb
...

Go makes this really easy with its built-in template functionality. Given the user-specified template string and the struct from which the data comes, it's trivial to loop through structs in a collection and output text in the format the user wants.

Note: This output feature can apply equally to other tools besides syft, but this is just a place to start.

This issue is related to anchore/grype#42, but takes a different, more generalized approach. Both approaches might be desired, and they wouldn't inherently conflict with each other.

@luhring luhring added the enhancement New feature or request label Aug 18, 2020
@wagoodman wagoodman added the I/O Describes bug or enhancement around application input or output label Aug 23, 2021
@nicosto
Copy link

nicosto commented Nov 1, 2021

Hi,
This will be really useful to have this to report to application that doesn't support cyclondx/spdx.

@luhring
Copy link
Contributor Author

luhring commented Jun 15, 2022

I'd like us to move forward on this now. But one update from the description — let's make sure to implement this functionality so that it's exactly the same experience for users as Grype's templating functionality, which is documented here: https://github.com/anchore/grype#using-templates

@jonasagx
Copy link
Contributor

jonasagx commented Jun 15, 2022

Nice, I can look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request I/O Describes bug or enhancement around application input or output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants