picocli-jansi-graalvm icon indicating copy to clipboard operation
picocli-jansi-graalvm copied to clipboard

Jansi 2 compatibility

Open knutwannheden opened this issue 2 years ago • 3 comments

Is this library compatible with Jansi 2? If yes, what does that mean for GraalVM compatibility? It looks like Jansi 2 already provides some level of native support. Is then this picocli-jansi-graalvm wrapper still required?

knutwannheden avatar Feb 25 '22 15:02 knutwannheden

Good question, but unfortunately I don't have time to investigate at the moment...

If you try this wrapper with Jansi 2, it would be great if you could provide feedback here; either any issues found, or the absence of issues would be valuable information.

remkop avatar Feb 28 '22 02:02 remkop

I haven't tested this in a native GraalVM image yet, but in JVM mode the ANSI support appears to be working. One thing that doesn't work however is the picocli.CommandLine.Help.Ansi#isJansiConsoleInstalled() method, since System.out doesn't appear to be assigned directly anymore with Jansi 2. But that is then really a picocli issue, since the mentioned method is part of that. I will report an issue there. I am not quite sure of what consequences it has that this method reports false rather than true.

knutwannheden avatar Feb 28 '22 13:02 knutwannheden

It seems like the isJansiConsoleInstalled() works fine after all. It appeared to not work in the context of jbang, since there the final jar is being minimized (see https://imperceptiblethoughts.com/shadow/configuration/minimizing/) and apparently that threw out a few things too many.

Meanwhile the AnsiConsole.out field has been marked as deprecated and client code is expected to call the static AnsiConsole.out() method instead. But that will show up anyway as soon as that field ends up being removed in Jansi.

knutwannheden avatar Feb 28 '22 14:02 knutwannheden