smallstep / cli

🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
https://smallstep.com/cli
Apache License 2.0
3.67k stars 255 forks source link

Add option for JSON output to (specific) CLI commands #550

Open hslatman opened 3 years ago

hslatman commented 3 years ago

What would you like to be added

Add a flag (e.g. --json) to make the CLI print its output in JSON format.

Why this is needed

Supporting JSON output provides for easier composability of command invocations. The CLI could be used with jq, for example, to filter or extract certain parts from the output.

Some things to take into account:

Also see: https://github.com/smallstep/cli/pull/512#discussion_r697624239, which was the reason for creating the issue.

maraino commented 3 years ago

Can you provide a list of some of these commands?

hslatman commented 2 years ago

As of now:

In general, output could be made more friendly to being piped into other tools for further processing.