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:
Some commands already print JSON by default
Error cases should be handled nicely (i.e. exit codes vs. printed errors)
Calling the APIs directly is of course also an option
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.