mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-13 09:40:42 +01:00
prettybat: Don't add extra newlines to tsv for gnu
This commit is contained in:
parent
043d2da964
commit
38bacab368
@ -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[@]}"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user