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
Add --color cli switch #320
Conversation
ac0ad03
to
fbc5187
Compare
I wonder why the build failed, but mostly why the target is |
Quick review assistance notes:
|
fbc5187
to
de6dfd4
Compare
Ah, no, it's more of a general issue with the rust toolchain, as the same issues appeared on the main branch. |
Thanks for your contribution! Yes, the CI seems to be broken for mac due to some changes in Rust v1.62. |
Could you elaborate? I created the PR using 1.62 on a Mac (Macbook Pro 16", M1 Pro CPU, on macos 12.14). I see no issues, but I didn't test every feature either.
I'll go over it once more as I see that some of the client/display/state code uses comfy-table directly, which means that my changes to how the dark-theme colours are used may be affected. |
I did indeed break dark styles for tables; I see two options to remedy this:
I'd pick the latter myself, so I'll just update the middle commit to do that. The other option would be to drop that commit. |
de6dfd4
to
fbf8696
Compare
So, the iOS build failure there was due to the cross-compilation toolchain not being installed, I fixed this in this PR by adding an extra commit that adds a I'll make that a separate PR against master, and I've removed the commit from this PR. Now, the PR build with the commit fails on the clippy issues you already fixed on master :-P |
fbf8696
to
578f690
Compare
Codecov Report
@@ Coverage Diff @@
## development #320 +/- ##
===============================================
- Coverage 53.13% 52.99% -0.14%
===============================================
Files 70 70
Lines 4705 4721 +16
===============================================
+ Hits 2500 2502 +2
- Misses 2205 2219 +14
Continue to review full report at Codecov.
|
Is the Windows test failure a flakey test? It also failed for a build of my toolchain PR but not when that PR was merged, but there the windows build was cancelled due to a codecov upload failure. |
@mjpieters Yep, the windows test is a flaky one :D There's already an open ticket on this: I tried to increase the wait threshold several times, but this seems a different problem at hand. The original implementor of the windows code didn't came up with a fix either and just suggested to increase the wait threshold. |
Thanks again for your contributions! I'm always very happy when I get such high-quality contributions! I'm also impressed by your detailed review and improvement of this project's CI! I definitely learned a few new things :) Much appreciated! |
FYI I decided to ignore the flaky windows test for now. Previously it only occurred every now and then, but recently it showed up much more consistently. My initial assuption would be that this has something to do with the current load on the Github's windows CI machines. |
This consolidates output style responsibility into a single struct. - Rename the Color struct to OutputStyle - Rename the module to 'style' - Move the 'style_text' helper into a method on OutputStyle - Update all uses to use `style` as the variable name.
- Remove the red/green/yellow/white methods, and instead have style_text swap out colours when styling. - Add a styled_cell method to ensure all Comfy-table output is following the same rules.
The default 'auto' enables styled output when connected to a tty. The other options are 'always' and 'never'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is your project, so I'll happily follow your style here.
And I agree that the Cell:new()
API is cleaner. I didn't want to completely replicate that API (return a custom Cell
struct which ignores chained fg()
and add_attribute()
calls when colours are disabled), perhaps this is something that the upstream comfy_table
project should provide.
578f690
to
adb59fb
Compare
Review adjustments look good to me :) Thanks again for your contribution! I'll try to release a minor version in the near future :) |
This adds a --color switch to the
pueue
command, controlling when output willinclude ANSI styles (colors, bolding). The default,
auto
matches the currentbehaviour: style when connected to a TTY.
This PR refactors the way styling is handled (consolidating color choices and
styling into a single location struct), and this struct then tracks if styling
can be output or not.
This would fix #318.
Checklist
CHANGELOG.md
.cargo clippy
andcargo fmt
. The CI will fail otherwise anyway.