Fix `--indent 0` implicitly enabling compact-output
Now it will retain pretty-printing, just removing any indentation. See also https://github.com/stedolan/jq/issues/1465.
Coverage increased (+0.4%) to 84.509% when pulling bedc1ff9bee5e99963486bf687077ca3663a8124 on amarshall:fix-indent-zero into 80052e5275ae8c45b20411eecdd49c945a64a412 on stedolan:master.
@itchyny I would argue this is a bug fix, not a feature request. The manpage doesn’t document the prior behavior, and --indent 0 behaves completely differently from any other value. That said, I understand someone, somewhere might be relying on the prior functionality. Ultimately it’s the decision of maintainers, I don’t mind either way.
Okay, rebase this PR, please. Also tests are needed.
Hmm, how do I approve the actions to run on this PR?
@nicowilliams i'm guessing it needs a new push to run
Seems to break --indent 1
$ ./jq --indent 0 -n '[{a:1}]'
[
{
"a": 1
}
]
$ ./jq --indent 1 -n '[{a:1}]'
[{"a":1}]
$ ./jq --indent 2 -n '[{a:1}]'
[
{
"a": 1
}
]
Maybe this is also an indication we should have some tests for indent/compact flags?