|
|
@ -29,7 +29,7 @@ function find_without_newline() { |
|
|
|
if [[ ! -z $f ]]; then |
|
|
|
if [[ ! -z $f ]]; then |
|
|
|
if [[ $(tail -c 1 "$f") != $NEWLINE ]]; then |
|
|
|
if [[ $(tail -c 1 "$f") != $NEWLINE ]]; then |
|
|
|
echo "Error: file '$f' is missing a trailing newline character." |
|
|
|
echo "Error: file '$f' is missing a trailing newline character." |
|
|
|
if $2; then # fix |
|
|
|
if $1; then # fix |
|
|
|
sed -i -e '$a\' $f |
|
|
|
sed -i -e '$a\' $f |
|
|
|
echo 'Fixed!' |
|
|
|
echo 'Fixed!' |
|
|
|
fi |
|
|
|
fi |
|
|
@ -39,11 +39,12 @@ function find_without_newline() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if [[ $# == 1 && $1 == '--fix' ]]; then |
|
|
|
if [[ $# == 1 && $1 == '--fix' ]]; then |
|
|
|
ERRORS=$(find_without_newline true) |
|
|
|
FIX=true |
|
|
|
else |
|
|
|
else |
|
|
|
ERRORS=$(find_without_newline false) |
|
|
|
FIX=false |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ERRORS=$(find_without_newline $FIX) |
|
|
|
if [[ "$ERRORS" != '' ]]; then |
|
|
|
if [[ "$ERRORS" != '' ]]; then |
|
|
|
echo "$ERRORS" |
|
|
|
echo "$ERRORS" |
|
|
|
if ! $FIX; then |
|
|
|
if ! $FIX; then |
|
|
|