Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created September 7, 2024 14:26
Show Gist options
  • Save wtnabe/34debec3d2ca9bb0c098155dae64c201 to your computer and use it in GitHub Desktop.
Save wtnabe/34debec3d2ca9bb0c098155dae64c201 to your computer and use it in GitHub Desktop.
#! /usr/bin/awk -f
#
# Usage:
# biome lint --colors off 2>&1 | awk
#
#
# filename
#
/^[^ ]/ {
if ($0 ~ /^(Checked|Found|lint)/) {
render_result()
} else {
render_result()
spec = $1
rule = $2
}
}
#
# message
#
/^ ×/ {
sub(/^[ ]+×[ ]+/, "")
message = $0
}
#
# content
#
/^ >/ {
split($0, c, "")
content = c[2]
}
END {
render_result()
}
function render_result() {
if (spec) {
print spec ":" content " ( " message " / " rule " ) "
spec = ""
content = ""
message = ""
rule = ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment