diff --git a/_reformat-common.sh b/_reformat-common.sh index 0e2fcd9..a857a84 100644 --- a/_reformat-common.sh +++ b/_reformat-common.sh @@ -15,6 +15,8 @@ function sniff_file_type () { file_type="css" elif [[ $ff == *.php ]] ; then file_type="php" + elif [[ $ff == *.html ]] ; then + file_type="html" fi echo $file_type diff --git a/do-reformat.sh b/do-reformat.sh index 4a74938..2eb4b83 100755 --- a/do-reformat.sh +++ b/do-reformat.sh @@ -15,7 +15,8 @@ if [[ $file_type == "javascript" || \ $file_type == "vue" || \ $file_type == "css" || \ $file_type == "typescript" || \ - $file_type == "php" ]] ; then + $file_type == "php" || \ + $file_type == "html" ]] ; then out=$(npx prettier --write $file) retval="$?" success_retval=0 diff --git a/would-reformat.sh b/would-reformat.sh index e3dda2d..ad47cb2 100755 --- a/would-reformat.sh +++ b/would-reformat.sh @@ -11,13 +11,12 @@ source "$DIR/_reformat-common.sh" file_type=$(sniff_file_type $file) -retval=0 -success_retval=0 if [[ $file_type == "javascript" || \ $file_type == "vue" || \ $file_type == "typescript" || \ $file_type == "css" || \ - $file_type == "php" ]] ; then + $file_type == "php" || \ + $file_type == "html" ]] ; then out=$(npx prettier --check $file 2>&1 > /dev/null) retval="$?" success_retval=0 @@ -43,6 +42,8 @@ elif [[ x"$retval" == x"$would_reformat_retval" ]] ; then exit 1 elif [[ x"$retval" == x"$syntax_error_retval" ]] ; then echo -n "syntax error" + echo + echo "$out" exit 2 else echo -n "problem running reformatter"