Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Printpcre2test output in colour.#811

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
NWilson merged 6 commits intoPCRE2Project:masterfromIsaacOscar:pcre2test_colour
Oct 12, 2025

Conversation

@IsaacOscar
Copy link
Contributor

@IsaacOscarIsaacOscar commentedOct 4, 2025
edited
Loading

This adds a-c option topcre2test that will print various different output in colour.

For ease of reviewing I've split the changes into two commits:

  1. contains the interesting changes, but it doesn't compile without the second commit.
  2. simply changes all remainingprintf,pchars, etc. calls to also include the colour to use.

Most output frompcre2test is given an explicit colour, however this is often justclr_output which is the terminals default colour (i.e. it likely won't be in "colour").

@IsaacOscarIsaacOscarforce-pushed thepcre2test_colour branch 3 times, most recently from06318ae to6539820CompareOctober 4, 2025 16:11
This commit makes various changes to to pcre2test to support colourisingthe output, in particular, the following colour scheme is intended: * Comments from the inputfile are in grey (but not those entered in   interactively) * All other input is in green * Messages related to PCRE2 api errors are in magenta * Messages related to errors with using pcre2test itself are in red * Timing and memory usage information is in blue * Normal output is in your terminal's default foreground colour * The interactive prompt is in blue * Anything withought an explicit colour set (e.g. stuff printed by   valgrind) should be in yellow
This finishes of the work started by the previous commit.
@NWilson
Copy link
Member

This is great! I have a few requests:

  • Ithink I prefer having the outputFILE* be explicit, and only output to stdout if it's not specified. This matches the C convention -printf goes to stdout, and all the other methods (fprintf etc) have an explicit output destination. This basically means adding "outfile" as an argument to your cprintf throughout. Thoughts?
  • I'd prefer--color={always,auto,never} instead of the confusingly-short-c. (I'm happy to addauto later myself. If it were to be the default, it would need to check isatty andgetenv("NO_COLOR") perhttps://no-color.org/.)
  • I'm not sure about the valgrind errors being yellow. Speculatively switching to yellow just in case anything else is printed seems a little eager. Why not just restore standard white for anything that doesn't need an explicit colour.

Copy link
Member

@NWilsonNWilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've made those changes. I'll merge it soon, unless you message to say there are additional changes you'd like to make.

Thank you very much Isaac!

@NWilsonNWilson merged commit0288afe intoPCRE2Project:masterOct 12, 2025
35 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NWilsonNWilsonNWilson approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@IsaacOscar@NWilson

[8]ページ先頭

©2009-2025 Movatter.jp