about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T14·01+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T14·50+0200
commit373fad75e19a2f24db512621b8cedb627d03d49d (patch)
tree640fd0cac2ccc58f2db5a3f39eba6d0d67badb22 /src/libutil/util.hh
parent392430b2c4ceb2e476abe2b3acc928581b2a1445 (diff)
Add some color
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 5f2d95339f30..f6f5d1b3fee7 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -369,4 +369,16 @@ string decodeOctalEscaped(const string & s);
 void ignoreException();
 
 
+/* Some ANSI escape sequences. */
+#define ANSI_NORMAL "\e[0m"
+#define ANSI_BOLD "\e[1m"
+#define ANSI_RED "\e[31;1m"
+
+
+/* Filter out ANSI escape codes from the given string. If ‘nixOnly’ is
+   set, only filter escape codes generated by Nixpkgs' stdenv (used to
+   denote nesting etc.). */
+string filterANSIEscapes(const string & s, bool nixOnly = false);
+
+
 }