Indented JSON is a reasonably human readable format per se. We should default to it and drop the current text format as it would help simplify the code that handles output formatting and printing.
In my view, we should:
--output flag entirely (it comes from tendermint cli libs, we could just ignore it and just pass json down to tendermint)--indent flag to accept a numerical value through which users may adjust output indentation according to their preferences.Indent could (should?) be set to zero to provide a compact, byte-saving machine parseable format. Users could adjust their preferences and set a custom indentation level globally via the gaiacli configuration file.
Please discuss @alexanderbez @jackzampolin @sabau @fedekunze @rigelrozanski
I'm OK with only supporting JSON as output 馃憣
If we have an --indent flag, it should take numeric values as you suggested with the default being either 0 or 2.
Meh I think I've changed my opinion. Like there is no question that the tabular keys need to reformatted, but I think Human-Readable Output is really important for some of the other structs. So like; why not still have HRO for keys in _non-tabular_ format? I think that's the real solution here. I've got strong doubts on exclusively using JSON.
Other structs would be printed in a prettified, human friendly JSON anyway. IMHO the greatest benefits of adopting JSON would come from making all human format handling code redundant
still not convinced we should just be printing JSON. However I hear you on the want to have redundant output for text and json. My compromise would be to have a text base "pretty" formatter, that would have input of json, and output human readable, by changing spacing, and removing { brackets etc. . For example:
JSON:
{
"name": "json.human",
"description": "Convert\n JSON to human readable\r HTML",
"author": "Mariano Guerra <[email protected]>",
"tags": ["DOM", "HTML", "JSON", "Pretty Print"],
"version": "0.1.0",
"main": "json.human.js",
"license" : "MIT",
"dependencies": {
"crel": "1.0.0"
},
}
HRO:
name: json.human
description: Convert\n JSON to human readable\r HTML
author: Mariano Guerra <[email protected]>
tags: [DOM, HTML, JSON, Pretty Print]
version: 0.1.0
main: json.human.js
license: MIT
dependencies:
crel: 1.0.0
I think this kind of processing printer probably already exists, OR can simply be made quite easily by parsing the JSON itself. Honestly it looks like if we just search replace " ,\n``{, }, that is pretty much it already
@rigelrozanski what you're describing as HRO looks like YAML. Perhaps we should support JSON and YAML where YAML is the "text" HRO. This should be trivial to implement and really cuts down on custom code.
Yes! That's YAML. I'd second that!
Yup sweet
Awesome -- love the "synergy" 馃槅
EDIT: @alessio mind updating the issue body with "acceptance criteria" please?
Will certainly do. BTW we might need to patch tendermint: https://github.com/tendermint/tendermint/blob/dfa9a9a30a666132425b29454e90a472aa579a48/libs/cli/setup.go#L154
@alessio why? text will just print/output YAML. I don't see a need to actually change Tendermint.