Added some ansi color escapes.
This commit is contained in:
parent
63ed265157
commit
9f4aa6a2e0
@ -95,7 +95,7 @@ with secrets:
|
||||
secret %approvals = []
|
||||
say ".."
|
||||
|Proposal:
|
||||
|\(%src)
|
||||
|\(bright)\(blue)\(%src)\(reset color)
|
||||
|
||||
parse [propose %action] as:
|
||||
propose source (..)
|
||||
@ -253,7 +253,7 @@ as bill: approve
|
||||
as dave: join
|
||||
|
||||
propose:
|
||||
rule [declare war] =: say "WAR!!!"
|
||||
rule [declare war] =: say "\(red)WAR!!!\(reset color)"
|
||||
with secrets:
|
||||
secret %president = (nil)
|
||||
rule [elect president from %candidates] =:
|
||||
|
@ -84,3 +84,33 @@ compile [max of %items by %value_expr] to:
|
||||
| return \(%value_expr as lua)
|
||||
|end)
|
||||
|
||||
# String utilities
|
||||
compile [nl, newline, line feed, linefeed, lf] to: ".."
|
||||
|"\n"
|
||||
compile [tab] to: ".."
|
||||
|"\t"
|
||||
compile [bell] to: ".."
|
||||
|"\a"
|
||||
compile [cr, carriage return] to: ".."
|
||||
|"\r"
|
||||
compile [backspace] to: ".."
|
||||
|"\b"
|
||||
compile [form feed, formfeed] to: ".."
|
||||
|"\f"
|
||||
compile [vertical tab] to: ".."
|
||||
|"\v"
|
||||
|
||||
lua code ".."
|
||||
|do;
|
||||
| local colors = {
|
||||
| ["reset color"] = 0, bright = 1, dim = 2, underscore = 4, blink = 5,
|
||||
| inverse = 7, hidden = 8, black = 30, red = 31, green = 32, yellow = 33,
|
||||
| blue = 34, magenta = 35, cyan = 36, white = 37, ["on black"] = 40,
|
||||
| ["on red"] = 41, ["on green"] = 42, ["on yellow"] = 43, ["on blue"] = 44,
|
||||
| ["on magenta"] = 45, ["on cyan"] = 46, ["on white"] = 47,
|
||||
| };
|
||||
| for name,code in pairs(colors) do;
|
||||
| local escape = "\\"\\\\27["..tostring(code).."m\\""
|
||||
| nomsu:defmacro(name, function() return escape end, "");
|
||||
| end;
|
||||
|end;
|
||||
|
Loading…
Reference in New Issue
Block a user