Colors in threads and --use-color parameter
Would be possible to add --use-color
parameter like clang-tidy
provides?
I try to explain why is needed, I'm trying to invoke clazy-standalone
in threads, and I did it in a few ways.
- I rewrote the
run-clang-tidy.py
script to invokeclazy-standalone
and it works great, it was so simple becauseclazy
has almost the same command-line parameters and works practically the same way asclang-tidy
- I'm able to invoke it in threads with help of
PowerShell
Start-Job
orForEach-Object -parallel
, below is the command that works great:
Get-ChildItem -Path src/*.cpp -Recurse | `
ForEach-Object -Parallel { `
clazy-standalone.exe --checks='level0,level1,level2' --extra-arg='-Qunused-arguments' `
--header-filter='orm/.*' -p .\compile_commands.json $_.FullName }
By help this thread invocation I can fasten clazy
analyses on my project from ~1min 50sec
to ~20sec
and that is a great performance boost
Now where the problem is.
When I invoke it like described above, then I lose colors, because clang
internally runs some color support detection and when it is not set explicitly it will use no coloring.
I already found some code that sets coloring in clang-tidy
eg. here and here is how this option in clang
works.
But I'm not capable enough to propose PR for this change
I have also tried to set -extra-arg/-before=-fcolor-diagnostics
without success
Also if you know about some workaround I would be really thankful.
Thank you for advice