https://github.com/jline/jline3
JLine is a Java library for handling console input.
https://github.com/jline/jline3
Last synced: about 1 month ago
JSON representation
JLine is a Java library for handling console input.
- Host: GitHub
- URL: https://github.com/jline/jline3
- Owner: jline
- License: other
- Created: 2016-05-31T18:00:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-05-06T07:31:34.000Z (about 1 month ago)
- Last Synced: 2025-05-06T16:14:43.727Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 8.86 MB
- Stars: 1,573
- Watchers: 40
- Forks: 226
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-java - JLine - Includes features from modern shells like completion or history. (Projects / CLI)
- awesome-cli-frameworks - Jline3
- awesome-java - JLine - Includes features from modern shells like completion or history. (Projects / CLI)
- awesome-java-zh - JLine - 包括从现代炮弹,如完成或历史的功能。 (项目 / CLI)
- fucking-awesome-java - JLine - Includes features from modern shells like completion or history. (Projects / CLI)
README
# JLine - Java Console Library
[](https://search.maven.org/search?q=g:org.jline)
[](https://github.com/jline/jline3/actions)
[](https://opensource.org/licenses/BSD-3-Clause)JLine is a Java library for handling console input. It's similar to [GNU Readline](https://tiswww.case.edu/php/chet/readline/rltop.html) but with a focus on portability, flexibility, and integration with Java applications. See https://jline.org for its documentation.
## Features
- **Cross-platform support**: Works on Windows, macOS, Linux, and other Unix-like systems
- **Line editing**: Emacs and Vi editing modes with customizable key bindings
- **History management**: Persistent command history with search capabilities
- **Tab completion**: Customizable completion for commands, arguments, and file paths
- **Syntax highlighting**: Colorize input based on custom rules
- **Password masking**: Secure input for sensitive information
- **ANSI terminal support**: Full support for ANSI escape sequences and colors
- **Unicode support**: Proper handling of wide characters and combining marks
- **ConsoleUI components**: Interactive UI elements like menus, checkboxes, and prompts## Installation
### Maven
```xml
org.jline
jline
3.30.0```
### Gradle
```groovy
implementation 'org.jline:jline:3.30.0'
```## Quick Start
Here's a simple example to get you started:
```java
import org.jline.reader.*;
import org.jline.reader.impl.*;
import org.jline.terminal.*;
import org.jline.terminal.impl.*;public class HelloJLine {
public static void main(String[] args) {
try {
// Create a terminal
Terminal terminal = TerminalBuilder.builder()
.system(true)
.build();// Create line reader
LineReader reader = LineReaderBuilder.builder()
.terminal(terminal)
.build();// Prompt and read input
String line = reader.readLine("JLine > ");// Print the result
System.out.println("You entered: " + line);
} catch (Exception e) {
e.printStackTrace();
}
}
}
```## Modules
JLine is organized into several modules:
- **jline-terminal**: Core terminal functionality
- **jline-reader**: Line editing and reading
- **jline-console**: Higher-level console abstractions
- **jline-console-ui**: Interactive UI components (checkboxes, lists, etc.)
- **jline-style**: Styling and coloring support
- **jline-builtins**: Built-in commands and utilities
- **jline-remote-ssh**: SSH server support
- **jline-remote-telnet**: Telnet server support## Documentation
- [Website](https://jline.org)
- [Wiki](https://github.com/jline/jline3/wiki)
- [Javadoc](https://www.javadoc.io/doc/org.jline/jline/latest/index.html)## License
JLine is licensed under the [BSD License](https://opensource.org/licenses/BSD-3-Clause).
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.