From c69758e4c750364645e02762cb4005a7fb7dc0e6 Mon Sep 17 00:00:00 2001
From: Jan Frenzel <jan.frenzel@tu-dresden.de>
Date: Thu, 3 Mar 2022 16:19:20 +0100
Subject: [PATCH] Added some comments about verbose and silent flags in
 grep-forbidden-patterns.sh.

---
 doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh b/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh
index 0d8dbb74b..bec44369e 100755
--- a/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh
+++ b/doc.zih.tu-dresden.de/util/grep-forbidden-patterns.sh
@@ -83,6 +83,7 @@ function checkFile(){
     fi
     IFS=$'\t' read -r flags pattern exceptionPatterns
     while IFS=$'\t' read -r -a exceptionPatternsArray; do
+      #Prevent patterns from being printed when the script is invoked with default arguments.
       if [ $verbose = true ]; then
         echo "  Pattern: $pattern$skipping"
       fi
@@ -96,6 +97,7 @@ function checkFile(){
         if grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
           number_of_matches=`grep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" | wc -l`
           ((cnt=cnt+$number_of_matches))
+          #prevent messages when silent=true, only files, pattern matches and the summary are printed
           if [ $silent = false ]; then
             echo "    $message"
           fi
@@ -122,7 +124,9 @@ EOF
 
 # Options
 all_files=false
+#if silent=true: avoid printing of messages
 silent=false
+#if verbose=true: print files first and the pattern that is checked
 verbose=false
 file=""
 color=""
@@ -166,6 +170,7 @@ else
   files=`git diff --name-only "$(git merge-base HEAD "$branch")"`
 fi
 
+#Prevent files from being printed when the script is invoked with default arguments.
 if [ $verbose = true ]; then
 echo "... $files ..."
 fi
-- 
GitLab