const R: &str = "\x1b[31m"; const Y: &str = "\x1b[33m"; const G: &str = "\x1b[32m"; const C: &str = "\x1b[36m"; const B: &str = "\x1b[34m"; const M: &str = "\x1b[35m"; const W: &str = "\x1b[37m"; const GR: &str = "\x1b[90m"; const X: &str = "\x1b[0m";
fn paint(color: bool, col: &str, s: &str) -> String {
if color {
format!("{col}{s}{X}")
} else {
s.to_string()
}
}
pub fn banner(color: bool) -> String {
let line = |col: &str, s: &str| paint(color, col, s);
let mut o = String::new();
o.push('\n');
o.push_str(&line(R, " โโโโโโโ โโโ โโโโโโโ โโโโโโโโโโโ\n"));
o.push_str(&line(Y, " โโโโโโโโโโโ โโโโโโโโ โโโโโโโโโโโ\n"));
o.push_str(&line(G, " โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโ \n"));
o.push_str(&line(C, " โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ \n"));
o.push_str(&line(B, " โโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ\n"));
o.push_str(&line(M, " โโโ โโโ โโโโโโโ โโโ โโโโโโโโโโโโโ\n"));
o.push_str(&line(W, " the robot scripting language\n"));
o.push('\n');
o.push_str(&line(GR, " Nox ยท 18-pattern tree reduction ยท Goldilocks field\n"));
o.push_str(&line(GR, " two registers (classic + pure) ยท one AST ยท instant start\n"));
o
}
pub fn help(color: bool) -> String {
let g = |s: &str| paint(color, GR, s);
let mut o = banner(color);
o.push('\n');
o.push_str(" rune start the REPL\n");
o.push_str(" rune eval [--pure] <expr> evaluate one expression\n");
o.push_str(" rune run <file> interpret a program\n");
o.push_str(" rune fmt [--to=โฆ] <file> format between registers (rust | rune)\n");
o.push_str(" rune check <file> type-check (mold) without running\n");
o.push('\n');
o.push_str(&g(" rune help print this help\n"));
o.push_str(&g(" rune --version print version\n"));
o
}
pub fn repl_help(color: bool) -> String {
let head = |s: &str| paint(color, W, s);
let g = |s: &str| paint(color, GR, s);
let mut o = String::new();
o.push_str(&head(" commands\n"));
o.push_str(&g(" :help this list\n"));
o.push_str(&g(" :env show bound names\n"));
o.push_str(&g(" :nox <expr> the Nox formula <expr> lowers to\n"));
o.push_str(&g(" :type <expr> mold-check <expr>\n"));
o.push_str(&g(" :ast <expr> the parsed AST\n"));
o.push_str(&g(" :load <file> run a file into the session\n"));
o.push_str(&g(" :reset clear bindings\n"));
o.push_str(&g(" :quit leave (Ctrl-D)\n"));
o.push('\n');
o.push_str(&head(" builtins\n"));
o.push_str(&g(" text anno error log button col prysm chunks\n"));
o.push_str(&g(" emit query link seal subscribe acts\n"));
o.push_str(&g(" add sub mul lt gt arithmetic\n"));
o.push('\n');
o.push_str(&head(" editing\n"));
o.push_str(&g(" โ โ history Ctrl-R search Tab complete\n"));
o.push_str(&g(" multi-line continues while ( [ or \" stay open\n"));
o.push('\n');
o.push_str(&head(" examples\n"));
o.push_str(&g(" let x = 5 bind a name (persists for later lines)\n"));
o.push_str(&g(" x * 2 evaluate against the bindings\n"));
o.push_str(&g(" col(text(\"a\"), error(\"b\"))\n"));
o
}