-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indent with tabs #800
Comments
An option to use a given number of spaces is doable. I don't care for an option to use tabs. |
Actually, indentation by 2 spaces is pretty hardcoded. Changing it is possible, of course, but not something I'm inclined to do at this time. I would consider a PR. |
While an alternative, I don't think adding an option to set the number of spaces to jq is the right approach. An appropriate tab stop is a presentation issue better solved a level higher — either in the terminal or text editor. Just like we set Another solution would be A workaround till then, for the record, is jq . | unexpand -t2 |
I could see using an env var for this, but I won't switch jq to using tabs by default, much less as the only setting. @stedolan likes 2-space indents, and I've grown accustomed to them :) I suspect if he were to voice an opinion, it'd be to keep things as-is, or maybe use an env var. I don't change the tabstop myself. You're the first person I know who does it (though I've heard that others do it, I'd never heard from someone who does do it). I did just learn that one can set the hard tab stops in most terminals (huh!)... I was about to point out that the terminal emulators I use don't have that option, and then I realized it must be a terminfo escape, and sure enough it is, and there's even a tabs(1) command to set the stops. Sadly I can't just set the tabstop in the terminal, I also have to tell apps like vim. How do you manage code with styles that set max line length at 79 columns? I think it must be confusing. But maybe you can convince me of the value of this lifestyle choice :)? As for unexpand... that's dangerous, because it will change whitespace in strings. At least tabs (and newlines, and...) in strings must be escaped, so the opposite would be OK (if jq were using tabs for indentation, which it isn't). |
I agree having it customizable would be the best. It's hard to post-process because you don't want to mess with whitespace in the output. It would be awesome if it could be any number of spaces or tabs. |
Ah, damn, indeed, the BSD version of unexpand kills tabs inside a line even if jq . | unexpand -t2 --first-only |
Fixed with 24a5e5b. |
Thanks so much! This is awesome.
|
Hey,
A very minor feature request, but would it be possible to get pretty printed output indented by tabs and not spaces? If necessary, configurable. Tab width tends to be user configurable everywhere, but using spaces assume a particular width preference and eyesight ability. ;-)
Thanks!
The text was updated successfully, but these errors were encountered: