ucoreTui
Terminal User Interface primitives for building rich CLIs.
Components
| Function | Returns | Description |
box(content, style) |
string |
Wrap content in styled box |
table(data) |
string |
Render 2D array as table |
tree(map) |
string |
Render nested tree view |
progressBar(cur, tot, w) |
string |
Generate progress bar |
spinner(style) |
Array |
Get animation frames |
Interactive Input
| Function | Returns | Description |
input(prompt) |
string |
Read line of text |
inputPassword(prompt) |
string |
Read password (masked) |
inputBox(title, w, def) |
string |
Input widget in a box |
confirm(prompt) |
bool |
Yes/No prompt |
select(prompt, options) |
int |
Menu selection (arrow keys) |
Basic Usage
Rich Output
print(ucoreTui.box("Welcome to Unnarize!", "rounded"));
var data = [
["ID", "Name"],
["1", "Alice"],
["2", "Bob"]
];
print(ucoreTui.table(data));
Interactive Prompts
var menu = ["Start", "Options", "Exit"];
var choice = ucoreTui.select("Main Menu", menu);
if (choice == 0) {
var name = ucoreTui.inputBox("Player Name", 40, "Guest");
print("Welcome, " + name);
}
Styling Primitives
| Function | Description |
clear() | Clear screen |
fg(color, text) | Set foreground color |
bg(color, text) | Set background color |
bold(text) | Bold text |
moveTo(row, col) | Move cursor |