Skip to content

Commit

Permalink
Allow jline help to be overridden by picocli help, which is much nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh authored and remkop committed Dec 14, 2020
1 parent 103ad14 commit a0574dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.jline.reader.LineReader;
import org.jline.reader.ParsedLine;
import org.jline.reader.impl.LineReaderImpl;
import org.jline.reader.impl.completer.ArgumentCompleter;
import org.jline.reader.impl.completer.NullCompleter;
import org.jline.reader.impl.completer.SystemCompleter;
import org.jline.utils.AttributedString;

Expand Down Expand Up @@ -110,9 +112,9 @@ public SystemCompleter compileCompleters() {
return out;
}

private class PicocliCompleter implements Completer {
private class PicocliCompleter extends ArgumentCompleter implements Completer {

public PicocliCompleter() {}
public PicocliCompleter() { super(NullCompleter.INSTANCE); }

@Override
public void complete(LineReader reader, ParsedLine commandLine, List<Candidate> candidates) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public static void main(String[] args) {
try (Terminal terminal = TerminalBuilder.builder().build()) {
SystemRegistry systemRegistry = new SystemRegistryImpl(parser, terminal, Example::workDir, null);
systemRegistry.setCommandRegistries(builtins, picocliCommands);
systemRegistry.register("help", picocliCommands);

LineReader reader = LineReaderBuilder.builder()
.terminal(terminal)
Expand Down

0 comments on commit a0574dd

Please sign in to comment.