summaryrefslogtreecommitdiffstats
path: root/tests/color.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-20 15:52:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-20 15:52:45 -0400
commit60366e4583a1d148dd5f8171c9148ebb98890478 (patch)
treef0ab64b754339b6c20b2c17b5a1798e44009391f /tests/color.sh
parent962d715ce2dee7a017dacca3b787ade6d33cd1c6 (diff)
downloadbfs-60366e4583a1d148dd5f8171c9148ebb98890478.tar.xz
tests/color: Remove some useless cats
Diffstat (limited to 'tests/color.sh')
-rw-r--r--tests/color.sh12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/color.sh b/tests/color.sh
index 0d6ef68..805d2b8 100644
--- a/tests/color.sh
+++ b/tests/color.sh
@@ -24,20 +24,14 @@ color_fd() {
color_fd 1 && COLOR_STDOUT=1 || COLOR_STDOUT=0
color_fd 2 && COLOR_STDERR=1 || COLOR_STDERR=0
-# Save these in case the tests unset PATH
-CAT=$(command -v cat)
+# Save this in case the tests unset PATH
SED=$(command -v sed)
# Filter out escape sequences if necessary
color() {
if color_fd 1; then
- "$CAT"
+ "$@"
else
- "$SED" $'s/\e\\[[^m]*m//g'
+ "$@" | "$SED" $'s/\e\\[[^m]*m//g'
fi
}
-
-# printf with auto-detected color support
-cprintf() {
- printf "$@" | color
-}