mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
Include actual count of files with CRLF endings found
The script has been updated to include the actual count of files with CRLF endings found. The exit status of the script now accurately reflects the number of files with incorrect line endings.
This commit is contained in:
committed by
Daniel Martí
parent
d3763143bd
commit
47296634f1
3
AUTHORS
3
AUTHORS
@@ -8,8 +8,9 @@
|
||||
|
||||
Andrew LeFevre <jalefevre@liberty.edu>
|
||||
Daniel Martí <mvdan@mvdan.cc>
|
||||
Emmanuel Chee-zaram Okeke <ecokeke21@gmail.com>
|
||||
Nicholas Jones <me@nicholasjon.es>
|
||||
Zachary Wasserman <zachwass2000@gmail.com>
|
||||
lu4p <lu4p@pm.me>
|
||||
pagran <pagran@protonmail.com>
|
||||
shellhazard <shellhazard@tutanota.com>
|
||||
shellhazard <shellhazard@tutanota.com>
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
if
|
||||
grep \
|
||||
--recursive \
|
||||
--files-with-matches \
|
||||
--binary \
|
||||
--binary-files=without-match \
|
||||
--max-count=1 \
|
||||
--exclude-dir="\.git" \
|
||||
$'\r' \
|
||||
.
|
||||
then
|
||||
# TODO exit status should be number of files with wrong endings found
|
||||
echo -e "Found at least a file with CRLF endings."
|
||||
exit 1
|
||||
file_count=$(grep \
|
||||
--recursive \
|
||||
--files-with-matches \
|
||||
--binary \
|
||||
--binary-files=without-match \
|
||||
--max-count=1 \
|
||||
--exclude-dir="\.git" \
|
||||
$'\r' \
|
||||
. | wc -l)
|
||||
|
||||
if [[ $file_count -gt 0 ]]; then
|
||||
echo -e "Found $file_count file(s) with CRLF endings."
|
||||
exit "$file_count"
|
||||
fi
|
||||
|
||||
echo -e "No files with CRLF endings found."
|
||||
|
||||
Reference in New Issue
Block a user