]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not show verbose messages if !tty
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 27 Nov 2019 13:42:39 +0000 (14:42 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 27 Nov 2019 13:54:53 +0000 (14:54 +0100)
build-scripts/format-code

index 13698a1d9f14c46be1c5d6021828c2de5442a2fb..ed4898f33b0fc2e6927a11db55daad902b41a5cc 100755 (executable)
@@ -20,9 +20,19 @@ if [ ! -e .clang-format ]; then
     exit 1
 fi
 
+verbose=0
+if tty > /dev/null; then
+    verbose=1
+fi
+if [ x$CIRCLECI = xtrue ]; then
+    verbose=0
+fi
+
 for file in "${@}"; do
     if [ -h "$file" -o ! -f "$file" ]; then
-        echo "$file: skipped, not a regular file or unreadable"
+        if [ $verbose = 1 ]; then
+            echo "$file: skipped, not a regular file or unreadable"
+        fi
         continue
     fi
     tmp=$(mktemp "$file.XXXXXXXX")
@@ -33,7 +43,9 @@ for file in "${@}"; do
             echo "$file: reformatted"
             mv "$tmp" "$file"
         else
-            echo "$file: already formatted to perfection"
+            if [ $verbose = 1 ]; then
+                echo "$file: already formatted to perfection"
+            fi
             rm "$tmp"
         fi
     fi