Re:Show HN: Catj – A new way to display JSON files
by pfranz on Saturday June 22, 2019 @02:41AM
(#20248347)
It does look like neither are needed if you pipe a file in jq, but `jq . file.json` requires the `.` and if you're pipeing into a pager, like less, you need both `.` and `-C` to get colored output (that was the case with the alias I had pulled up). I am using 1.5 and haven't looked to see if 1.6 changes this.
[ Parent
| on HN ]
Re:Show HN: Catj – A new way to display JSON files
by jolmg on Saturday June 22, 2019 @02:51AM
(#20248368)
I see. I doubt that behavior has changed, then.
`-C` would be required when piping because most of the time (with the exception of piping into less) when stdout is not a terminal, it doesn't make sense to include terminal color escape sequences. You'd end up with those codes in your files, and grep would be looking at them for matches, for example.
`.` would be required when passing the file as an argument instead of stdin, because jq interprets the first argument as jq-code. If you don't include `.` it would interpret the filename as jq-code.
Re:Show HN: Catj – A new way to display JSON files
by pfranz on Sunday June 23, 2019 @01:01AM
(#20253399)
`.` is still needed if I'm pipeing in json--but only when I'm piping out. Otherwise help goes to stderr and nothing goes to stdout.
I do honestly think jq is a cool and powerful tool. I also appreciate little things like auto-color when appropriate--git also does this. Git also uses your pager, which might trivialize my personal use case.