mithril icon indicating copy to clipboard operation
mithril copied to clipboard

Provide machine-readable output for mithril-client

Open abailly-iohk opened this issue 3 years ago • 0 comments

Why

When trying to use mithril-client in a script, using the docker image, I do the following:

$ docker run --rm -ti -e NETWORK=$NETWORK -e AGGREGATOR_ENDPOINT=$AGGREGATOR_ENDPOINT ghcr.io/input-output-hk/mithril-client:latest list
+---------+-------+-----------+------------------------------------------------------------------+------------+-----------+--------------------------------+
| Network | Epoch | Immutable | Digest                                                           | Size       | Locations | Created                        |
+---------+-------+-----------+------------------------------------------------------------------+------------+-----------+--------------------------------+
| testnet | 226   | 3119      | 8b259d5d2e88675a964bb9f118cddc90464ae5e4e8b73d10e631ed266af8b48f | 5712502757 |         1 | 2022-08-30T11:47:49.359596553Z |
+---------+-------+-----------+------------------------------------------------------------------+------------+-----------+--------------------------------+
| testnet | 226   | 3118      | e5c72a6843d3fbdc3ed916e5ae72bafc5b7377096ce1246ed382cf7e9e74b24e | 5712619005 |         1 | 2022-08-30T06:18:06.325716556Z |
+---------+-------+-----------+------------------------------------------------------------------+------------+-----------+--------------------------------+
| testnet | 226   | 3117      | a2c47b13fad0b2bc7a95d29a9c0ea581c2e60eed67ad9a52e133ff6f47697049 | 5711586977 |         1 | 2022-08-30T00:09:02.446817513Z |
+---------+-------+-----------+------------------------------------------------------------------+------------+-----------+--------------------------------+

This format is not very suitable to machine consumption, eg. piping to jq to extract the latest available snapshot or other informations.

What

Provide a --raw or similar flag to mithril-client that outputs the same data in raw JSON format.

abailly-iohk avatar Aug 30 '22 17:08 abailly-iohk