feat: `-q`/`--quiet` for quietening progress output
https://user-images.githubusercontent.com/35064754/178306069-dd094047-a2b7-4dfe-a376-3b42ec2a7c3c.mp4
Here's why I think Zig might be attractive to language devs as a language to compile to:
- Zig compiles quickly (and will only get quicker in the future).
- Zig has multiple codegen backends.
- Zig has structs with unspecified field order for performance and other optimizations Zig facilitates that are not available in C.
And with this option Zig will be even more attractive as a language to compile to because now people can abstract zig being invoked under the hood to do the codegen for their language.
Of course, there are more reasons you might want to silence zig's compile output. In fact, maybe as part of your workflow zig runs somewhere else where nobody sees it so by using -q you can silence the output that nobody sees anyway and possibly gain a few negligible milliseconds or so of improved compilation speed.
Can you give an example where someone would want to use -q instead of --color off?
- I think
-qis kind of conventional. One could expect a compiler to have this option, similarly to expecting--colorto be an option. - I don't think
--color offshould turn off progress output. It's unexpected. The documentation is misleading too. The things should be separate.
So all in all I think some change is required here. TERM=dumb turning off both color and progress output makes sense however.
I fixed this PR and addressed my comment above; here's a conclusion:
-
--color offno longer turns off progress output but turns off color. -
TERM=dumbturns off progress output and color. -
NO_COLOR=leaves progress output on but turns off color (same as--color off; can probably be removed). -
--quietturns off progress output and leaves on color. -
ZIG_DEBUG_COLOR=leaves on progress output and leaves on color (I don't know why we need this?)
Did I miss anything?
I think this is the expected behavior.
This also kind of goes in hand with #12989 after which this will look clearer.
By the way, I think we could also remove --color auto but apart from that this PR is still mergeable as-is.
I can rebase and resolve the conflicts if my conclusion above is agreed to. Otherwise, feel free to close.
So I'm in a situation right now where I would really like to turn off progress output but leave on color. I cannot find any way to do this. This PR seems to fix this.
Looking back at it, I still think we should remove NO_COLOR, ZIG_DEBUG_COLOR, and --color auto. Why make it so hard to choose? --color off to turn off only color and --quiet to turn off progress output makes perfect sense to me. And finally TERM=dumb would still disable both.
So I'm in a situation right now where I would really like to turn off progress output but leave on color.
The docgen could also use this though parsing the escape sequences produced by std.Progress isn't too hard either.
Thanks for this patch. This is a bit tricky of a problem to sort out so I want to personally examine it carefully. I'm tackling this as part of #14647.