cli
cli copied to clipboard
Add option for JSON output to (specific) CLI commands
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:
- 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
- ...
Also see: https://github.com/smallstep/cli/pull/512#discussion_r697624239, which was the reason for creating the issue.
Can you provide a list of some of these commands?
As of now:
- EAB management (
acme eab list|add|remove|get)
In general, output could be made more friendly to being piped into other tools for further processing.