!verity 4b44c1d155 Add Help component for CLI usage and input validation support
- Introduced `Help` class for generating CLI help/usage blocks with options, descriptions, and customizable formatting.
- Enhanced `Prompt` and `PromptBuilder` with validation capabilities using predicates and retry messages.
- Added terminal control methods `clearScreen` and `cursorTo` with ANSI support.
- Updated examples and documentation (`Examples.md`, `Components.md`) to showcase the new features.
- Extended `Examples` class with a `helpBlock` method for demonstrating the `Help` usage.
2026-03-14 12:00:31 +01:00

terminal-ui

Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList, pager, and more. Fluent API, ANSI support, testable.

CI Java 21 License: MIT Latest release

Open in GitHub Codespaces

Install

Gradle (Kotlin DSL):

repositories {
    mavenCentral()
    maven { url = uri("https://maven.pkg.github.com/jakubbbdev/terminal-ui") }
}
dependencies {
    implementation("dev.jakub.terminal:terminal-ui:VERSION")
}

Gradle (Groovy):

repositories {
    mavenCentral()
    maven { url "https://maven.pkg.github.com/jakubbbdev/terminal-ui" }
}
dependencies {
    implementation "dev.jakub.terminal:terminal-ui:VERSION"
}

Maven:

<repository>
  <id>github</id>
  <url>https://maven.pkg.github.com/jakubbbdev/terminal-ui</url>
</repository>
<dependency>
  <groupId>dev.jakub.terminal</groupId>
  <artifactId>terminal-ui</artifactId>
  <version>VERSION</version>
</dependency>

Requirements

  • Java 21
  • Gradle 9.x (wrapper included)

Build & Test

./gradlew build

Run tests:

./gradlew test

Usage (excerpt)

import dev.jakub.terminal.Terminal;
import dev.jakub.terminal.core.Color;

// Colored text
Terminal.print("Hello").color(Color.CYAN).bold().println();

// Table
Terminal.table()
    .header("A", "B")
    .row("1", "2")
    .row("3", "4")
    .print(System.out);

// Prompt
String name = Terminal.prompt("Name: ").ask();

// Menu
String choice = Terminal.menu()
    .title("Environment")
    .option("Dev").option("Prod")
    .select();

License

See LICENSE.

Description
Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList, pager, and more. Fluent API, ANSI support, testable.
Readme MIT 228 KiB
Languages
Java 100%