dotfiles/bin/find_crlf

31 lines
437 B
Bash
Executable File

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