|
@@ -16,7 +16,11 @@ coerce__nocolor() {
|
16
|
16
|
#
|
17
|
17
|
# Remove ANSI color codes
|
18
|
18
|
#
|
19
|
|
- perl -CS -Mutf8 -MTerm::ANSIColor=colorstrip -ne 'print colorstrip $_;'
|
|
19
|
+ if $__COERCE__LEGACY; then
|
|
20
|
+ sed 's/\x1b\[[0-9;]*m//g'
|
|
21
|
+ else
|
|
22
|
+ perl -CS -Mutf8 -MTerm::ANSIColor=colorstrip -ne 'print colorstrip $_;'
|
|
23
|
+ fi
|
20
|
24
|
}
|
21
|
25
|
|
22
|
26
|
coerce__noctl() {
|
|
@@ -66,6 +70,15 @@ coerce__for_yaml() {
|
66
|
70
|
perl -CS -Mutf8 -pe "tr/$(__coerce__for_yaml_bad)/$COERCE__REPCHAR/"
|
67
|
71
|
}
|
68
|
72
|
|
|
73
|
+#
|
|
74
|
+# Legacy mode
|
|
75
|
+#
|
|
76
|
+# If 'true', avoids using Term::ANSIColor in favor of a local hacky
|
|
77
|
+# sed expression yanked from stackoverflow. Use if Term::ANSIColor
|
|
78
|
+# is not available (as is case of eg. RHEL-6).
|
|
79
|
+#
|
|
80
|
+__COERCE__LEGACY=${__COERCE__LEGACY:-false}
|
|
81
|
+
|
69
|
82
|
__coerce__for_yaml_bad() {
|
70
|
83
|
#
|
71
|
84
|
# Print all YAML-bad chars
|