Look instead for '# cheat.sh: ' on any line

This is in regards to a request by Chubin on #134.

I didn't use grep(1), because it wound up being a lot slower than my
method. Relying on tools like that isn't always the best choice, which
is why I often just write in pure-shell, and have done for a couple of
years now. There's a time and a place for those external tools, but I
feel this was not it.

Tested and worked well. I've actually seen no noteworthy slowdowns, -
despite pre-processing the files -- YMMV.
pull/138/head
terminalforlife 4 years ago
parent 49be860e84
commit bf73be6b35

@ -148,20 +148,31 @@ Main(){
for File in "${Dirs[@]}"; {
[ -f "$File" ] || continue
# Per chubin's desire to have an "in-bound flag"; see #134.
if [ "$NoLenChkLine" != 'True' ]; then
SkipFile='False'
readarray -t Buffer < "$File"
for BufferLine in "${Buffer[@]}"; {
if [[ $BufferLine == '# cheat.sh: '* ]]; then
CheatLine=${BufferLine#'# cheat.sh: '}
IFS=',' read -a Fields <<< "$CheatLine"
for Field in "${Fields[@]}"; {
[ "$Field" == "$Progrm=disable" ] && SkipFile='True'
}
fi
}
[ "$SkipFile" == 'True' ] && continue
fi
# If the current file matches one which is whitelisted, skip it.
for CurWL in "${Whitelisted[@]}"; {
[ "$File" == "$CurWL" ] && continue 2
}
# Per chubin's desire to have an "in-bound flag"; see #134 for info.
if [ "$NoLenChkLine" != 'True' ]; then
read Buffer < "$File"
[ "$Buffer" == 'lenchk=disable' ] && continue
fi
HaveBeenHit='False'
LineNum=0
HaveBeenHit='False'
while read; do
let LineNum++

Loading…
Cancel
Save