From 34139db70917b17a1dbcc54569a837c427b14c40 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Fri, 30 Jul 2021 17:05:52 +0200 Subject: [PATCH 1/2] [#1397] Update Jline2 README.md to add some recommended workaround Signed-off-by: Simon Bernard --- picocli-shell-jline2/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/picocli-shell-jline2/README.md b/picocli-shell-jline2/README.md index 89d4cd2b0..b8da42f99 100644 --- a/picocli-shell-jline2/README.md +++ b/picocli-shell-jline2/README.md @@ -155,6 +155,16 @@ public class Example { } public static void main(String[] args) { + + // JLine 2 does not detect some terminal as not ANSI compatible (e.g Eclipse Console) + // See : https://github.com/jline/jline2/issues/185 + // This is an optional workaround which allow to use picocli heuristic instead : + if (!Help.Ansi.AUTO.enabled() && // + Configuration.getString(TerminalFactory.JLINE_TERMINAL, TerminalFactory.AUTO).toLowerCase() + .equals(TerminalFactory.AUTO)) { + TerminalFactory.configure(Type.NONE); + } + try { ConsoleReader reader = new ConsoleReader(); IFactory factory = new CustomFactory(new InteractiveParameterConsumer(reader)); @@ -255,4 +265,4 @@ public class CustomFactory implements IFactory { } } -``` \ No newline at end of file +``` From fcd7bdab83d08a8385facf13b768e222f99e1c8a Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Fri, 30 Jul 2021 17:08:11 +0200 Subject: [PATCH 2/2] Fix footer Jline2 Example. Signed-off-by: Simon Bernard --- picocli-shell-jline2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/picocli-shell-jline2/README.md b/picocli-shell-jline2/README.md index b8da42f99..c9c1c1819 100644 --- a/picocli-shell-jline2/README.md +++ b/picocli-shell-jline2/README.md @@ -71,7 +71,7 @@ public class Example { * Top-level command that just prints help. */ @Command(name = "", description = "Example interactive shell with completion", - footer = {"", "Press Ctrl-D to exit."}, + footer = {"", "Press Ctrl-C to exit."}, subcommands = {MyCommand.class, ClearScreen.class, ReadInteractive.class}) static class CliCommands implements Runnable { final ConsoleReader reader;