Skip to content

Instantly share code, notes, and snippets.

@mattmc3
Last active January 22, 2021 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmc3/6ca92822f518f702bbe26fb8c6f28c15 to your computer and use it in GitHub Desktop.
Save mattmc3/6ca92822f518f702bbe26fb8c6f28c15 to your computer and use it in GitHub Desktop.
awk TAP colorizer
#!/usr/bin/env -S awk -f
# https://testanything.org
BEGIN {
CYAN="\033[0;36m"
GREEN="\033[0;32m"
RED="\033[0;31m"
BRIGHTGREEN="\033[1;92m"
BRIGHTRED="\033[1;91m"
NORMAL="\033[0;0m"
}
/^ok / { print GREEN $0 NORMAL; next }
/^not ok / { print RED $0 NORMAL; next }
/^\# ok$/ { print BRIGHTGREEN $0 NORMAL; next }
/^\# pass / { print BRIGHTGREEN $0 NORMAL; next }
/^\# fail / { print BRIGHTRED $0 NORMAL; next }
/^\#/ { print CYAN $0 NORMAL; next }
{ print $0 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment