Skip to content
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

Fix color codes used even when --color never is specified #148

Merged
merged 6 commits into from
Dec 10, 2023
Merged

Conversation

cschreib
Copy link
Member

This PR fixes #147:

  • The registry class now forwards its with_color option to the print_help() function, so ./tests --color never --help prints the help text without color codes.
  • The command-line parser now parses arguments in two passes. The first pass looks only at color options, silently ignoring any problem, then changes the color configuration as specified. The second pass looks again at all options, and reports any problem using the color options configured in the first pass. This means that, for example, ./tests --color never --verbosity babbling will report the unknown babbling value without using color codes.

Note that, in both cases, argument ordering remains irrelevant, so --color never --help and --help --color never produces the same output.

Copy link

codecov bot commented Dec 10, 2023

Codecov Report

Merging #148 (fa587c0) into main (770286e) will increase coverage by 0.10%.
Report is 2 commits behind head on main.
The diff coverage is 72.13%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
+ Coverage   93.67%   93.78%   +0.10%     
==========================================
  Files          27       27              
  Lines        1597     1624      +27     
==========================================
+ Hits         1496     1523      +27     
  Misses        101      101              
Files Coverage Δ
include/snitch/snitch_cli.hpp 100.00% <ø> (ø)
src/snitch_registry.cpp 94.88% <100.00%> (ø)
src/snitch_cli.cpp 83.87% <71.66%> (+2.73%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 770286e...fa587c0. Read the comment docs.

@cschreib cschreib merged commit be8414f into main Dec 10, 2023
42 of 43 checks passed
@cschreib cschreib deleted the nocolor branch December 10, 2023 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ANSI escape sequences are displayed in Windows console
1 participant