Skip to content
Snippets Groups Projects
Commit 19b62d4a authored by Norman Koch's avatar Norman Koch
Browse files

added -c for grep color, also added trailing whitespace and todo check

parent c85c6552
No related branches found
No related tags found
3 merge requests!392Merge preview into contrib guide for browser users,!377Merge preview into main,!370Added patterns to check whether "todo" appears
......@@ -18,9 +18,9 @@ i file \+system HDFS
i \<taurus\> taurus\.hrsk /taurus /TAURUS
i \<hrskii\>
i hpc[ -]\+da\>
i attachurl
i todo <!--.*-->
s \+$
i ATTACHURL
i \<todo\>
i [[:space:]]$
i \(alpha\|ml\|haswell\|romeo\|gpu\|smp\|julia\|hpdlf\|scs5\)-\?\(interactive\)\?[^a-z]*partition
i \[\s\?\(documentation\|here\|this \(link\|page\|subsection\)\|slides\?\|manpage\)\s\?\]
i work[ -]\+space"
......@@ -48,13 +48,15 @@ function usage () {
echo " -f Search in a specific markdown file"
echo " -s Silent mode"
echo " -h Show help message"
echo " -c Show git matches in color"
}
# Options
all_files=false
silent=false
file=""
while getopts ":ahsf:" option; do
color=""
while getopts ":ahsf:c" option; do
case $option in
a)
all_files=true
......@@ -66,6 +68,9 @@ while getopts ":ahsf:" option; do
s)
silent=true
;;
c)
color=" --color=always "
;;
h)
usage
exit;;
......@@ -108,7 +113,7 @@ for f in $files; do
grepflag=-i
;;
esac
if grep -n $grepflag "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
if egrep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
((cnt=cnt+1))
fi
done <<< $exceptionPatterns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment