ANSI color support using Groovy on Windows XP
Try the examples found at pleac.sf.net , I cannot get an ANSI color example to work my WinXP box (works fine on macOS). I found that on my WinXP machine, the cygwin and DOS prompts (and 'groovysh --terminal = unix' ) show return codes rather than the expected colored prompt. works fine on cygwin terminal. I cannot find anything obvious that I am wrong. Any ideas? groovysh --color
grep --color
Note: I am using Groovy 1.6.0
Update: I tried to add ANSI.sys to my config.nt mentioned here by Groovy -dev mailing list , but that didn't fix the problem (also tried reloading).
a source to share
The thing is, you need to add DOSONLY to your CONFIG.NT to get the ANSI.SYS driver to work, and then it will only work for COMMAND.COM which emulates DOS 5.0. Regular command prompts (CMD.EXE) do not support ANSI colors at all, afaict.
I don't know much about how cygwin handles it.
a source to share
I have the same problem, my solution is ugly but simple: Pipe groovy output to cygwin cat.exe Suppose your script is red.groovy:
println "\u001B[31mI'm Red\u001B[0m Now not"
Then from the command shell
groovy.bat red.groovy | cat
the correct colors are displayed. Of course, you can write your own custom code that handles ANSI codes.
a source to share