ucoreTui

Terminal User Interface primitives for building rich CLIs.

Components

FunctionReturnsDescription
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

FunctionReturnsDescription
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

// Styled Box
print(ucoreTui.box("Welcome to Unnarize!", "rounded"));

// Table
var data = [
    ["ID", "Name"],
    ["1", "Alice"],
    ["2", "Bob"]
];
print(ucoreTui.table(data));

Interactive Prompts

// Selection Menu
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

FunctionDescription
clear()Clear screen
fg(color, text)Set foreground color
bg(color, text)Set background color
bold(text)Bold text
moveTo(row, col)Move cursor