-
Couldn't load subscription status.
- Fork 235
LineReader
Guillaume Nodet edited this page May 12, 2025
·
7 revisions
ℹ️ Info: The JLine wiki content has been integrated into the new web site. The wiki won't be updated anymore.
The LineReader interface allows reading lines from a terminal, with full input/line editing.
Instances of LineReader can be obtained using the LineReaderBuilder class:
Terminal terminal = ...;
LineReader lineReader = LineReaderBuilder.builder()
.terminal(terminal)
.build();The builder can be customised to create more suitable line readers:
LineReader lineReader = LineReaderBuilder.builder()
.terminal(terminal)
.completer(new MyCompleter())
.highlighter(new MyHighlighter())
.parser(new MyParser())
.build();| Option | Description |
|---|---|
| terminal | The Terminal to use |
| appName | The application name |
| variables | A Map<String, Object> containing variables |
| completer | The Completer component to use |
| history | The History component to use |
| highlighter | The [Highlighter](Highlighting and parsing) component to use |
| parser | The [Parser](Highlighting and parsing) component to use |
| expander | The [Expander](Variable expansion) component to use |
See Using line readers.