-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve command output with text banner, colour and alignment #113
Conversation
Looks like I need to update the tests - so moving this PR back to draft form. I'll do that this evening hopefully then re-open for review. |
Thanks @abhidg for the review. Very good point, I didn't think to check how the output looks on a light-on-dark (light background) colour scheme, since I always use light-on-dark. What you show in your screenshot looks fine in my view, too, though I think I should probably change the colour of the 'CATS' capital lettering to be the default colour rather than white (so black in your screenshot case, like the plain text), to ensure it is always visible. In the next few days I shall get the tests updated here and add some testing of the new |
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.
Yep - looks good to me - I like it. Couple of questions.
First, what does this do for people who use screen readers in a terminal? I've no idea if people do use screen readers for working in a terminal (or, indeed, who to ask for advice on this) but I do wonder if an option to revert back to not using a text banner could help with accessibility. Actually, there seems to be one study (it claims to be the only one) at https://dl.acm.org/doi/fullHtml/10.1145/3411764.3445544. Section 5.4 may be relevant. Having said that, I suspect our json output format is already a big win for that. I'm agnostic about this.
Second, do you think it's worth putting the option to turn the banner and/or the colours off in the configuration file (or should we just expect that people know how shell aliases work)? Again, I'm agnostic.
Thanks @andreww for the review. Very good point RE accessibility.
Given this thought I am wondering if we could perhaps replace the 'no colour' option I've used in this PR as-is with a more general 'minimal' (
Good point also. I will look into the means to specify via the configuration file when I update this PR, hopefully tomorrow. Though since it concerns the command output itself, I personally think it is OK to have it just as something for the CLI, unless all of the other options are possible to set both from a config. file or the command-line, in which case I don't want to create some weird special case. I'll report back once I update the PR. |
1a9c24d
to
e648100
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #113 +/- ##
==========================================
- Coverage 89.23% 88.48% -0.76%
==========================================
Files 14 14
Lines 548 573 +25
==========================================
+ Hits 489 507 +18
- Misses 59 66 +7 ☔ View full report in Codecov by Sentry. |
Hi @abhidg @andreww, sorry this fell off my radar but I've come back now and finalised it to include addressing your feedback. Changes since your initial review are:
One thing I haven't included is logic to add the I haven't included explicit testing for the colour of the STDOUT since I don't know and can't, from some online investigation, see a way to test on whether the output is rendered in colour, but I guess I could test on having the right ANSI escape sequences in the output is good enough? If you agree, I will add a few tests that check that. I've also realised there are some documentation snippets with the STDOUT shown which I will need to update in line with this PR, so there are a few more commits to add but in a self-contained way (tests, docs), so feel free to re-review my updates at this point, or wait until I've added those if you prefer. |
Bump @GreenScheduler/cats team - this PR has been sitting there a while now but is ready to go in my eyes - it has already had a few reviews and I have responded to all feedback after those so just needs a quick re-review to ensure the new commit changes are OK and/or an overall sanity check. |
Thanks, looks good! |
Close #105, including adding primitive colour to the terminal STDOUT, which can be disabled with a new CLI option
--no-colour
(shorthand-n
) like with other standard commands, which make use of colour by default, allowing the choice to not add colour at all.With this PR we go from a (human-readable, machine
--format=json
output unchanged with no colour) output without an ASCII text banner, to one with one before any logging or printing output, so from this:to this (add banner, align figures, subsume the format info message into the logging system):
though note I can't demonstrate the colours introduced through the a markdown code snippet, so here is a demonstrative screenshot of what output you get from the same command on the current
main
and on this branch:Reviewing
I am happy to tweak any subjective elements e.g. the styling of the ASCII banner or the colours chosen, etc., but thought for progress it best put this PR up as a suggestion on these.
As for the banner design chosen for this starting point:
I could go a little crazier with the colours but thought it best to keep it fairly minimal mostly to highlight any green as 'good' (or strictly, 'better') and red as 'bad' ('worse') for the figures as well as a little, but less so, emphasis on the CATS banner text.