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.
This commit is contained in:
@@ -26,11 +26,12 @@ Overview of what terminal-ui provides. All entry points are on `Terminal.*`.
|
||||
|
||||
| API | Description |
|
||||
|-----|-------------|
|
||||
| `Terminal.prompt(String)` | Text input (`.ask()`, `.masked().ask()`) |
|
||||
| `Terminal.prompt(String)` | Text input (`.ask()`, `.masked().ask()`, `.validate(Predicate).retryMessage(String)`) |
|
||||
| `Terminal.confirm(String)` | Y/n confirmation |
|
||||
| `Terminal.menu()` | Numbered menu (`.option()`, `.select()`) |
|
||||
| `Terminal.selectList()` | List with arrow keys + Enter |
|
||||
| `Terminal.pager()` | Paged output (Enter/arrows/q) |
|
||||
| `Terminal.help()` | CLI usage block (`.option(opt, desc)`, `.title()`) |
|
||||
|
||||
## Live / progress
|
||||
|
||||
@@ -50,6 +51,13 @@ Overview of what terminal-ui provides. All entry points are on `Terminal.*`.
|
||||
| `Terminal.heatmap()` | Heatmap |
|
||||
| `Terminal.chart()` | Charts |
|
||||
|
||||
## Terminal control (ANSI)
|
||||
|
||||
| API | Description |
|
||||
|-----|-------------|
|
||||
| `Terminal.clearScreen()` | Clear entire screen |
|
||||
| `Terminal.cursorTo(row, col)` | Move cursor (1-based) |
|
||||
|
||||
## Other
|
||||
|
||||
| API | Description |
|
||||
|
||||
Reference in New Issue
Block a user