diff options
author | Sean Dague | 2008-07-10 00:05:21 +0000 |
---|---|---|
committer | Sean Dague | 2008-07-10 00:05:21 +0000 |
commit | 9a06bf47b96a393a95b3a5348368a79f9570121f (patch) | |
tree | 7f35205e56c6bffe9d973278eb0007e1aa446d59 /nant-color | |
parent | added .gitignore which makes using git-svn easier (diff) | |
download | opensim-SC-9a06bf47b96a393a95b3a5348368a79f9570121f.zip opensim-SC-9a06bf47b96a393a95b3a5348368a79f9570121f.tar.gz opensim-SC-9a06bf47b96a393a95b3a5348368a79f9570121f.tar.bz2 opensim-SC-9a06bf47b96a393a95b3a5348368a79f9570121f.tar.xz |
added convenience makefile and nant-color script. I've had these
on my laptop forever, and others might find them useful to be part
of the main tree.
Diffstat (limited to 'nant-color')
-rwxr-xr-x | nant-color | 52 |
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 | |||
4 | def 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 | } | ||
12 | end | ||
13 | |||
14 | def clear | ||
15 | return "\e[0m" | ||
16 | end | ||
17 | |||
18 | def red(str) | ||
19 | return "\e[31m" + str + clear | ||
20 | end | ||
21 | |||
22 | def green(str) | ||
23 | return "\e[32m" + str + clear | ||
24 | end | ||
25 | |||
26 | def yellow(str) | ||
27 | return "\e[33m" + str + clear | ||
28 | end | ||
29 | |||
30 | def black | ||
31 | return "\e[30m" | ||
32 | end | ||
33 | |||
34 | def hide | ||
35 | return "\e[8m" | ||
36 | end | ||
37 | |||
38 | def bright | ||
39 | return "\e[1m" | ||
40 | end | ||
41 | |||
42 | def 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 | ||
50 | end | ||
51 | |||
52 | main() | ||