pinterest/knox

Suggestion: flag for `knox acl` to output JSON

markjm opened this issue · 1 comments

Hi all - small suggestion for the knox acl command. Sometimes I will create a new secret starting from the same "configuration" as the other. To do so, I can pipe knox get old | knox create new, but then need to do some manual changes to the output of knox acl old. This is because the acl command iterated through an array and json-ifys each entry, instead of json-ifying it all together.

Actual:

{"type":"User","id":"markjm","access":"Admin"}
{"type":"UserGroup","id":"markjm-group","access":"Admin"}

Expected (with new JSON flag)

[
{"type":"User","id":"markjm","access":"Admin"},
{"type":"UserGroup","id":"markjm-group","access":"Admin"}
]

Please also let me know if there is another command I am missing that would fulfill my request. Happy to implement these changes if agreed upon. Thanks!

As a workaround, you can use jq to turn the stream of JSON objects into a list:

knox acl KEY-ID | jq -s .