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 ...@@ -18,9 +18,9 @@ i file \+system HDFS
i \<taurus\> taurus\.hrsk /taurus /TAURUS i \<taurus\> taurus\.hrsk /taurus /TAURUS
i \<hrskii\> i \<hrskii\>
i hpc[ -]\+da\> i hpc[ -]\+da\>
i attachurl i ATTACHURL
i todo <!--.*--> i \<todo\>
s \+$ i [[:space:]]$
i \(alpha\|ml\|haswell\|romeo\|gpu\|smp\|julia\|hpdlf\|scs5\)-\?\(interactive\)\?[^a-z]*partition 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 \[\s\?\(documentation\|here\|this \(link\|page\|subsection\)\|slides\?\|manpage\)\s\?\]
i work[ -]\+space" i work[ -]\+space"
...@@ -48,13 +48,15 @@ function usage () { ...@@ -48,13 +48,15 @@ function usage () {
echo " -f Search in a specific markdown file" echo " -f Search in a specific markdown file"
echo " -s Silent mode" echo " -s Silent mode"
echo " -h Show help message" echo " -h Show help message"
echo " -c Show git matches in color"
} }
# Options # Options
all_files=false all_files=false
silent=false silent=false
file="" file=""
while getopts ":ahsf:" option; do color=""
while getopts ":ahsf:c" option; do
case $option in case $option in
a) a)
all_files=true all_files=true
...@@ -66,6 +68,9 @@ while getopts ":ahsf:" option; do ...@@ -66,6 +68,9 @@ while getopts ":ahsf:" option; do
s) s)
silent=true silent=true
;; ;;
c)
color=" --color=always "
;;
h) h)
usage usage
exit;; exit;;
...@@ -108,7 +113,7 @@ for f in $files; do ...@@ -108,7 +113,7 @@ for f in $files; do
grepflag=-i grepflag=-i
;; ;;
esac esac
if grep -n $grepflag "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then if egrep -n $grepflag $color "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
((cnt=cnt+1)) ((cnt=cnt+1))
fi fi
done <<< $exceptionPatterns 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