Skip to content

[FR] - CLI improvements for formatting and consistency #3213

Open
@disassembler

Description

@disassembler

Internal/External
Internal if an IOHK staff member.

Area

Other Any other topic (Delegation, Ranking, ...).

Describe the feature you'd like
Currently, we abuse a lot of the UI output of CLI in internal and community tools. We also trick the CLI into giving us json for some commands but not others by setting an --out-file /dev/stdout. Ideally, we'd have a unified interface that could be used for scripts for all CLI commands that provide output to the terminal. My thoughts are add a --format flag that is required for any command in CLI that gives output and initially only support plain and json gives a machine readable format that can be used for scripts.

Some examples:
for submit, something like:

{ "status": "submitted", "txid": TXID }

OR for failure

{ "status": "error", "txid": TXID, "message": "ERROR MESSAGE" }

For things like query utxo, --out-file would give the default format for the command and be overridable with the --format flag.

I think every query command absolutely needs a --format json flag added to it.

For commands that are already json, they should support a --format plain option (for example with tip.

transaction view should have the yaml format parsed as json with --format json flag.

Also, all query commands should support --out-file to put output in the specified format output to a file instead of stdout.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context / screenshots
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions