File tree Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 20
20
* A simple log/printing utility module.
21
21
*/
22
22
23
+ /**
24
+ * Text colour codes
25
+ * (see http://ozzmaker.com/add-colour-to-text-in-python/)
26
+ *
27
+ * Text Style Background
28
+ * ---- ----- ----------
29
+ * Black 30 No effect 0 Black 40
30
+ * Red 31 Bold 1 Red 41
31
+ * Green 32 Underline 2 Green 42
32
+ * Yellow 33 Negative1 3 Yellow 43
33
+ * Blue 34 Negative2 5 Blue 44
34
+ * Purple 35 Purple 45
35
+ * Cyan 36 Cyan 46
36
+ * White 37 White 47
37
+ */
38
+
23
39
/**
24
40
* Print a simple separator (a bar) to stdout.
25
41
* Used to visually separate generated output into logical blocks.
@@ -42,6 +58,34 @@ static info(String tag, msg) {
42
58
43
59
}
44
60
61
+ /**
62
+ * Turns text printing BOLD.
63
+ */
64
+ static text_style_bold () {
65
+ print " " + (char )27 + " [1m"
66
+ }
67
+
68
+ /**
69
+ * Turns text printing RED.
70
+ */
71
+ static text_colour_red () {
72
+ print " " + (char )27 + " [31m"
73
+ }
74
+
75
+ /**
76
+ * Turns text printing GREEN.
77
+ */
78
+ static text_colour_green () {
79
+ print " " + (char )27 + " [32m"
80
+ }
81
+
82
+ /**
83
+ * Returns text printing colour to normal (default).
84
+ */
85
+ static text_normal () {
86
+ print " " + (char )27 + " [39m" + (char )27 + " [0m"
87
+ }
88
+
45
89
/**
46
90
* Print an error message.
47
91
*/
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import org.apache.commons.cli.Option
33
33
34
34
// Version
35
35
// Update with every change/release
36
- String version = ' 2.6.1 '
36
+ String version = ' 2.6.2 '
37
37
38
38
println " +------------------+"
39
39
println " | PipelineTester | v$version "
Original file line number Diff line number Diff line change @@ -424,22 +424,35 @@ class Tester {
424
424
*/
425
425
private dumpCommandError (StringBuilder errString ) {
426
426
427
+ Log . text_colour_red()
428
+ Log . text_style_bold()
427
429
println " $dumpErrPrefix STDERR Follows..."
430
+ Log . text_normal()
431
+
432
+ Log . text_colour_red()
428
433
errString. toString(). split(' \n ' ). each { line ->
429
434
println " $dumpErrPrefix $line "
430
435
}
436
+ Log . text_normal()
431
437
432
438
}
433
439
434
440
/**
435
441
* Dumps the pipeline command's output, used when the user's used '-v'.
442
+ * It uses control-codes to change the text color (see Log.groovy).
436
443
*/
437
444
private dumpCommandOutput (StringBuilder outString ) {
438
445
446
+ Log . text_colour_green()
447
+ Log . text_style_bold()
439
448
println " $dumpOutPrefix STDOUT Follows..."
449
+ Log . text_normal()
450
+
451
+ Log . text_colour_green()
440
452
outString. toString(). split(' \n ' ). each { line ->
441
453
println " $dumpOutPrefix $line "
442
454
}
455
+ Log . text_normal()
443
456
444
457
}
445
458
You can’t perform that action at this time.
0 commit comments