Index: lib/src/utils.dart |
diff --git a/lib/src/utils.dart b/lib/src/utils.dart |
index 07d7df5dbb058d61ece4d91241c7d007f1183f4c..da20c3ec0c7e60a0da30c0a4653cc5778d03c97f 100644 |
--- a/lib/src/utils.dart |
+++ b/lib/src/utils.dart |
@@ -83,6 +83,12 @@ String getErrorMessage(error) => |
String indent(String str) => |
str.replaceAll(new RegExp("^", multiLine: true), " "); |
+/// A regular expression matching terminal color codes. |
+final _colorCode = new RegExp('\u001b\\[[0-9;]+m'); |
+ |
+/// Returns [str] without any color codes. |
+String withoutColors(String str) => str.replaceAll(_colorCode, ''); |
+ |
/// A regular expression matching the path to a temporary file used to start an |
/// isolate. |
/// |