aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2021-01-08 13:41:37 +0000
committers-ol <s-ol@users.noreply.github.com>2021-01-08 13:41:43 +0000
commit4d7fe8008d34772f0fc2071c3d5738c786a1ae75 (patch)
treed14045973a8dde4b22ae2b40055c2643f2a0986a
parentshow meta.description field in module docs (diff)
downloadalive-4d7fe8008d34772f0fc2071c3d5738c786a1ae75.tar.gz
alive-4d7fe8008d34772f0fc2071c3d5738c786a1ae75.zip
copilot/cli: colorize output linewise
-rw-r--r--alv/copilot/cli.moon9
1 files changed, 8 insertions, 1 deletions
diff --git a/alv/copilot/cli.moon b/alv/copilot/cli.moon
index e4e633a..14bfd6b 100644
--- a/alv/copilot/cli.moon
+++ b/alv/copilot/cli.moon
@@ -7,12 +7,19 @@ import parse_args, Copilot from require 'alv.copilot.base'
import sleep from require 'system'
class ColorLogger extends Logger
+ new: (...) =>
+ super ...
+ @time_pref = ''
+
set_time: (time) =>
super time
- @stream\write switch time
+ @time_pref = switch time
when 'eval' then '\27[92m'
when 'run' then '\27[0m'
+ put: (msg) =>
+ super @time_pref .. msg
+
class CLICopilot extends Copilot
new: (arg) =>
super parse_args arg, { nocolor: false, 'udp-server': false }