dotfiles/bin/find_crlf

31 lines
437 B
Text
Raw Permalink Normal View History

#!/bin/bash
EXCLUDES=(
"*/node_modules/*"
"*/.git/*"
"*/__pycache__/*"
"*/venv/*"
)
EXCLUDE_PARAMS=()
2021-05-31 14:25:39 +02:00
QUIET=
if [[ $1 == '-q' ]]; then
QUIET=1
fi
for path in "${EXCLUDES[@]}"; do
EXCLUDE_PARAMS+=("-not" "-path" "$path")
done
2021-05-31 14:25:39 +02:00
find_grep_crlf() {
find . -type f "${EXCLUDE_PARAMS[@]}" -exec file '{}' \; | grep 'CRLF'
}
2021-05-31 14:25:39 +02:00
if [[ -n $QUIET ]]; then
find_grep_crlf | cut -d: -f1
else
find_grep_crlf
fi