aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nant-color
diff options
context:
space:
mode:
Diffstat (limited to 'nant-color')
-rwxr-xr-xnant-color52
1 files changed, 52 insertions, 0 deletions
diff --git a/nant-color b/nant-color
new file mode 100755
index 0000000..ca5ea37
--- /dev/null
+++ b/nant-color
@@ -0,0 +1,52 @@
1#!/usr/bin/ruby
2
3
4def main
5 IO.popen("nant #{ARGV.join(' ')}") { |pipe|
6 pipe.sync = true
7 while str = pipe.gets
8 str.sub!(/\n+/, '')
9 puts colorize(str)
10 end
11 }
12end
13
14def clear
15 return "\e[0m"
16end
17
18def red(str)
19 return "\e[31m" + str + clear
20end
21
22def green(str)
23 return "\e[32m" + str + clear
24end
25
26def yellow(str)
27 return "\e[33m" + str + clear
28end
29
30def black
31 return "\e[30m"
32end
33
34def hide
35 return "\e[8m"
36end
37
38def bright
39 return "\e[1m"
40end
41
42def colorize(str)
43 str.sub!(/(error \w+:.*)/, red('\1'))
44 str.sub!(/(warning \w+:.*)/, yellow('\1'))
45
46 str.sub!(/(Build Succeeded)/i, green('\1'))
47 str.sub!(/(Compilation succeeded)/, green('\1'))
48 str.sub!(/(\d+ warning\(s\))/, yellow('\1'))
49 return str
50end
51
52main()