prettybat: Don't add extra newlines to tsv for gnu

This commit is contained in:
Ethan P. 2024-06-01 15:30:30 -07:00
parent 043d2da964
commit 38bacab368
No known key found for this signature in database
GPG Key ID: 1BA2A0CC7C22B854

View File

@ -155,6 +155,7 @@ formatter_column_supports() {
}
formatter_column_process() {
local needs_newline=true
local args=(
-t
-s $'\t'
@ -164,9 +165,10 @@ formatter_column_process() {
if column --help &>/dev/null; then
# GNU `column`
args+=(--keep-empty-lines)
needs_newline=false
fi
sed 's/$/\n/' | column "${args[@]}"
{ { "$needs_newline" && sed 's/$/\n/'; } || cat; } | column "${args[@]}"
}
# -----------------------------------------------------------------------------