CLI commands: use built-in JSON functionality instead of re-implementing it as needed #5175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
We had a few commands that manually added JSON output. This change moves them to use the ui.json function instead.
I modified ui.json to only attempt stringification of the input if it isn't already a string. The reason this was added is because the wallet:export/import flow would require a lot more substantial changes to work with pretty-printed JSON, and the wallet export RPC already exports the stringified JSON. I would prefer if this wasn't the case, but don't think the effort is worth tackling at this point.
I also slightly modified the output of some of the commands to be more valid JSON or clearer output.
config:get
- added the config name so its a little easier to readconfig:get --json
config
- use the ui.card for normal displayCloses IFL-2820
Testing Plan
Documentation
N/A
Breaking Change
N/A