Closed uli-heller closed 10 months ago
Thanks for this suggestion. Back then, it was a design decision not to use a "wrapping" JSON structure around the commands to allow for immediate processing in the JSON-reader. Otherwise, on my machine, jq
does not output anything until it has parsed shournal's total output. This can be slow, when a large history is queried for. Instead, I suggest the following:
shournal -q --output-format json --history 10000 | grep -F 'COMMAND:' | sed -n 's/COMMAND://p' | jq
In principle, of course it would also be possible to add a, e.g., cjson
(for canonical json) output format, when speed is no priority.
OK, I understand this. Although the name "--output-format json" suggests to me that the complete output is valid json. Using the suggestion above and your evaluation command, this might produce similar output:
shournal -q --output-format json --history 10000 | grep -F ' {"command":'|jq
I agree. However, people may rely on the current quirky format and usually I try to avoid interface-breaking changes. I keep that as a "maybe_todo" 🙂
No problem, thx.
An example using "jq" to pretty-print the json:
Without "jq":
Maybe a format like this is better: