]> git.corax.cc Git - toolbox/commitdiff
include/log: Fix invalid decision to read from stdin in log_highlight()
authorMatthias Kruk <m@m10k.eu>
Sat, 26 Jun 2021 01:58:11 +0000 (10:58 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 26 Jun 2021 02:07:11 +0000 (11:07 +0900)
Because the boundaries aren't correct, log_highlight() will attempt to
read input from stdin if only one line was passed in positional
parameters.
This commit fixes the boundary so that log_highlight() will print any
number of lines correctly, whether passed in positional parameters or
via stdin.

include/log.sh

index 51712066db90c61452e8886718c4582f66e21cd9..d5e866b8262fa9024c4f5a0495a2fc6bf9a6491d 100644 (file)
@@ -135,7 +135,7 @@ log_highlight() {
        local lines=("${@:2}")
 
        echo "===== BEGIN $tag ====="
-       if (( ${#lines[@]} > 1 )); then
+       if (( ${#lines[@]} > 0 )); then
                local arg
 
                for arg in "${lines[@]}"; do