diff --git a/CHANGELOG.md b/CHANGELOG.md index 941e4e3c..b704eec2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # unreleased ## Features +* Add a `zbat` wrapper script to automatically decompress files before display, see PR #3177 (@anarcat) ## Bugfixes * Fix `BAT_THEME_DARK` and `BAT_THEME_LIGHT` being ignored, see issue #3171 and PR #3168 (@bash) diff --git a/bin/zbat b/bin/zbat new file mode 100755 index 00000000..977c4a05 --- /dev/null +++ b/bin/zbat @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e +set -u +# shellcheck disable=SC3040 +(set -o pipefail 2> /dev/null) && set -o pipefail + +cpath="$1" +# cpath without suffix +path="$(echo $cpath | sed 's/\.[^.]*$//')" + +( bsdcat "$path" || gunzip -c "$path" ) | batcat --file-name "$path"