Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jline2 README.md to add some recommended workaround about not ANSI compatible terminal #1399

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions picocli-shell-jline2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -255,4 +265,4 @@ public class CustomFactory implements IFactory {
}
}

```
```