LucidPlan
Login
Projects
🔗 go to
Byggsteg
Emacs Packages
Hygguile
Iter Vitae
LucidPlan
Supreme Sexp System
Uberprojekt
Wikimusic
Wolk JJBA
jjba23 Socials
pop-server
pop-test
title
status
To-do
Work in Progress
In Review
Done
Rejected
type
Task
Bug
Story
Spike
Time Box
description
Here's a guile script to colorize the output; should be a drop-in replacement for that awk: #+begin_src scheme #!/usr/bin/env guile !# (use-modules (ice-9 regex) (ice-9 rdelim)) ;;; Macro to loop over lines of current input port, ;;; matching against a series of regular expressions. ;;; Tries to be efficient by compiling all the REs outside the loop. (define-syntax awkish (lambda (stx) (syntax-case stx (else) ((_ var (pat body ...) ... (else else-body ...)) (with-syntax (((re ...) (datum->syntax #f (generate-temporaries #'(pat ...))))) #'(let ((re (make-regexp pat)) ...) (do ((var (read-line) (read-line))) ((eof-object? var)) (cond ((regexp-exec re var) body ...) ... (else else-body ...))))))))) ;;; output utilities (define colors '((red . 31) (green . 32) (yellow . 33) (blue . 34) (magenta . 35) (cyan . 36))) (define (colored col str) (format #t "\x1B[~Am~A\x1B[0m\n" (cdr (assq col colors)) str)) ;;; the real work happens here (awkish line ("compiling|compiled" (colored 'blue line)) ("WARNING" (colored 'yellow line)) ("(Entering|Leaving) test group" (colored 'cyan line)) ("PASS" (colored 'green line)) ("# of expected passes" (colored 'cyan line)) ("FAIL" (colored 'red line)) (else (write-line line))) #+end_src Note use of symbolic color names to make it more obvious what color each matching line should be.
submit