From 928a1db13c8662b8ea366301ea13cc1629ba9c52 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Thu, 26 Mar 2020 14:41:06 +1100 Subject: [PATCH] colours in the shell! --- lib/shell.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/shell.lua b/lib/shell.lua index 696cc26..b5912d5 100644 --- a/lib/shell.lua +++ b/lib/shell.lua @@ -22,17 +22,18 @@ function shell.interactive() local shenv = setmetatable({}, {__index=shindex}) local run = true while run do - io.write(string.format("%s:%s> ",os.getenv("HOSTNAME") or "localhost",(os.getenv("PWD") or _VERSION))) + io.write(string.format("\27[32m%s:%s>\27[0m ",os.getenv("HOSTNAME") or "localhost",(os.getenv("PWD") or _VERSION))) local input = io.read() if input:sub(1,1) == "=" then input = "return "..input:sub(2) end local f, r = load(input, "shell", "t", shenv) if not f then - print(r) + print("\27[31m"..r) else local rt = {pcall(f)} local rs = table.remove(rt,1) + if not rs then io.write("\27[31m") end for k,v in pairs(rt) do print(formatValue(v)) end