Moved colors to only when invoking from command line.

This commit is contained in:
Bruce Hill 2017-10-08 20:41:05 -07:00
parent 87e4777aee
commit e8c820b8f5
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,11 @@ local re = require('re')
local lpeg = require('lpeg')
local utils = require('utils')
local repr = utils.repr
local colors = require('consolecolors')
local colors = setmetatable({ }, {
__index = function()
return ""
end
})
local colored = setmetatable({ }, {
__index = function(_, color)
return (function(msg)
@ -842,6 +846,7 @@ do
NomsuCompiler = _class_0
end
if arg then
colors = require('consolecolors')
local parser = re.compile([[ args <- {| {:flags: flags? :} ({:input: input :} ";" ("-o;"{:output: output :} ";")?)? (";")? |} !.
flags <- (({| ({flag} ";")* |}) -> set)
flag <- "-c" / "-i" / "-p" / "-f" / "--help" / "-h"

View File

@ -15,7 +15,7 @@ re = require 're'
lpeg = require 'lpeg'
utils = require 'utils'
repr = utils.repr
colors = require 'consolecolors'
colors = setmetatable({}, {__index:->""})
colored = setmetatable({}, {__index:(_,color)-> ((msg)-> colors[color]..msg..colors.reset)})
{:insert, :remove, :concat} = table
--pcall = (fn,...)-> true, fn(...)
@ -591,6 +591,8 @@ class NomsuCompiler
if arg
export colors
colors = require 'consolecolors'
parser = re.compile([[
args <- {| {:flags: flags? :} ({:input: input :} ";" ("-o;"{:output: output :} ";")?)? (";")? |} !.
flags <- (({| ({flag} ";")* |}) -> set)