Closed ameba23 closed 1 week ago
Since this is a breaking change it is paired with a PR in programs to update the CLI for deploying programs, which has entropy-test-cli
as a dependency. https://github.com/entropyxyz/programs/pull/96
This looks good to me, thank you!
Closes https://github.com/entropyxyz/entropy-core/issues/1163
This adds optional JSON output to the test CLI.
This is activated with the
--json
or-j
command line argument. Note that it must be given before the subcommand like this:entropy-test-cli --json status
and notentropy-test-cli status --json
.Currently not all available information is given, for example the status command gives you the hashes of stored programs and account ids of registered accounts, but not the additional metadata you will see in the non-json output, such as which programs are associated with which account, who stored a program, how many times a program was used, etc. These fields could easily be added so please say if they would be useful.
Generally binary data is represented as hex.
Example output:
For commands which finish successfully with no output, an empty JSON object is displayed:
{}
. Im not sure if it would be more appropriate to just give no ouput.Errors
Errors are currently not displayed as JSON. If a command fails, the exit status will be
1
, and the original error message will be displayed to standard error. If needed we could wrap this in{ "error": "error message" }
, but actually serializing the errors to JSON is probably going to be tricky as i imagine they will not all implementSerialize
.