zig icon indicating copy to clipboard operation
zig copied to clipboard

feat: `-q`/`--quiet` for quietening progress output

Open wooster0 opened this issue 1 year ago • 3 comments

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.

wooster0 avatar Jul 11 '22 15:07 wooster0

Can you give an example where someone would want to use -q instead of --color off?

andrewrk avatar Jul 12 '22 00:07 andrewrk

  1. I think -q is kind of conventional. One could expect a compiler to have this option, similarly to expecting --color to be an option.
  2. I don't think --color off should 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.

wooster0 avatar Jul 12 '22 08:07 wooster0

I fixed this PR and addressed my comment above; here's a conclusion:

  • --color off no longer turns off progress output but turns off color.
  • TERM=dumb turns off progress output and color.
  • NO_COLOR= leaves progress output on but turns off color (same as --color off; can probably be removed).
  • --quiet turns 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.

wooster0 avatar Oct 16 '22 11:10 wooster0