Skip to content

Commit 0288afe

Browse files
IsaacOscarNWilson
andauthored
Print pcre2test output in colour. (#811)
* Add a --colour flag to pcre2test to colourise the output. * 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 --------- Co-authored-by: Nicholas Wilson <[email protected]>
1 parent 2662e1b commit 0288afe

File tree

6 files changed

+1074
-917
lines changed

6 files changed

+1074
-917
lines changed

RunTest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ checkresult()
198198
checkspecial()
199199
{
200200
expect=${2:-0}
201-
$sim $valgrind $vjs $pcre2test $1 >>testSoutput
201+
$sim $valgrind $vjs $pcre2test $1 >>testSoutput 2>&1
202202
if [ $? -ne "$expect" ] ; then
203203
echo "** pcre2test $1 failed - check testSoutput"
204204
yield=1

doc/html/pcre2test.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ <h2><a name="SEC4" href="#TOC1">COMMAND LINE OPTIONS</a></h2>
213213
If an unknown option is given, an error message is output; the exit code is 0.
214214
</p>
215215
<p>
216+
<b>--colo[u]r[=&#60;always,auto,never&#62;]</b>
217+
By default, the output is coloured if the output file is a terminal (<b>auto</b>).
218+
Force or suppress output of ANSI colour escapes with <b>always</b> and <b>never</b>
219+
respectively.
220+
</p>
221+
<p>
216222
<b>-d</b>
217223
Behave as if each pattern has the <b>debug</b> modifier; the internal
218224
form and information about the compiled pattern is output after compilation;

doc/pcre2test.1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ information. It returns one of the following values:
179179
.sp
180180
If an unknown option is given, an error message is output; the exit code is 0.
181181
.TP 10
182+
\fB--colo[u]r[=<always,auto,never>]\fP
183+
By default, the output is coloured if the output file is a terminal (\fBauto\fP).
184+
Force or suppress output of ANSI colour escapes with \fBalways\fP and \fBnever\fP
185+
respectively.
186+
.TP 10
182187
\fB-d\fP
183188
Behave as if each pattern has the \fBdebug\fP modifier; the internal
184189
form and information about the compiled pattern is output after compilation;

0 commit comments

Comments
 (0)