I just tried to use JCurses from within Groovy, but I always get the following exception:
Caused by: java.lang.NullPointerException at
jcurses.system.Toolkit.getLibraryPath(Toolkit.java:97) at
jcurses.system.Toolkit.<clinit>(Toolkit.java:37)
Toolkit.java:37 :
String url = ClassLoader.getSystemClassLoader()\
.getResource("jcurses/system/Toolkit.class").toString();
Google told me that it could have to do with spaces within the classpath (windows), but moving the library and even using the classes instead of the .jar file was not successful.
It seems to be possible - pleac for groovy references JCurses: http://pleac.sourceforge.net/pleac_groovy/userinterfaces.html
Another way to clear the screen from within a Groovy shell script would also solve my problem. :-)
As jline is bundled with Groovy, can't you use the class
jline.ANSIBuffer.ANSICodes
(as is shows in the page you linked to)You might also need to do:
If you want the cursor to go back to the top of the screen
To draw coloured text, you can do: